MySQL Forums
Forum List  »  Stored Procedures

Re: SELECT id, myFunc(id) FROM aTable ORDER BY id; returns bad data
Posted by: Jay Pipes
Date: September 23, 2005 08:02AM

Don't know if this is the source of your issues, but the following:

EXISTS (SELECT count(*) FROM users WHERE userID = usrID)

will always return true, as the SELECT will always return a single row. Since the EXISTS tests for the return of one or more rows, it will always return true. I believe you need:

EXISTS (SELECT NULL FROM users WHERE userID = usrID)

This will return no rows if there is none found.

Jay Pipes
Community Relations Manager, North America, MySQL Inc.

Got Cluster? http://www.mysql.com/cluster
Personal: http://jpipes.com

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.