Um, if there aren't any records in tbl1.id that match tbl2.id, it will return zero records. I am not away of the ability to output strings as custom errors, but you will get an Empty Set result. You can use that result in whatever front-end language you are using to output anything you like.
Does that not fit in with your plans? # Nathan ----- Original Message ----- From: "Forer, Leif" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, March 05, 2002 11:56 AM Subject: SELECT this IF that I want to select and join data from two tables if the same id exists in both tables. If the id only exists in one table I want MySQL to return a string like "sorry, no records found". How can I do this? I'm guessing it's something like: mysql> SELECT tbl1.this, tbl2.that FROM tbl1, tbl2 WHERE IF (tbl1.id = tbl2.id, return the data, "no record"); (Obviously that's not a real query). ************************************************************************** This e-mail and any files transmitted with it may contain privileged or confidential information. It is solely for use by the individual for whom it is intended, even if addressed incorrectly. If you received this e-mail in error, please notify the sender; do not disclose, copy, distribute, or take any action in reliance on the contents of this information; and delete it from your system. Any other use of this e-mail is prohibited. Thank you for your compliance. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php