Check manual on ISNULL or another MYSQL functions that deal with NULL and return 0 or 1. ----- Original Message ----- From: S A <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 08, 2001 3:34 AM Subject: how to get SELECT to return 0 or 1 for WHERE match ? > > I want to SELECT on one term & have the SELECT return as quickly as possible on the first TRUE instance. > > Ideally I'd like it to after the first matching case stop looking for other matches ( for speed ) and return 1. If there's no matches at all I want it to return 0. > > This works OK but returns either the date or an empty set. > > SELECT thread_last_post_date FROM threads WHERE thread_last_post_date > '2001-02-01' LIMIT 1; > > I know from Perl or PHP I can check the number of returned rows but I'd like something that just returns 0 or 1 so I don't have to special case. > > I'd like something like below but which work (it returns 2 rows of 1 for some reason ) : > > SELECT 1 FROM threads WHERE thread_last_post_date > '2001-02-01' LIMIT 1; > > thanks, > > - Sam. > > > > --------------------------------- > Do You Yahoo!? > Yahoo! Auctions - Buy the things you want at great prices.