+ Reply to Thread
Results 1 to 2 of 2

Thread: Stored Procedures Returning Select

  1. #1

    Stored Procedures Returning Select

    I have a problem with a sql query , the below code is just the logical prototype :
    Code:
    DECLARE Existing INT DEFAULT 0;SELECT SQL_CALC_FOUND_ROWS name FROM users WHERE id = pid LIMIT 1;SELECT FOUND_ROWS() INTO Existing;Select Existing;
    when I run it it always returns the first SELECT results. but I expect it to return the last SELECT results. Is this normal? If so, how can I change it ? and thanks in advance .

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    41
    you could try the below code , it is so close to what you need :
    Code:
    SELECT COALESCE(id/id, 0) AS Existing FROM users WHERE id = pid  LIMIT 1;

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts