Re: Finding existence of a value in a table

From: Date: Wed, 14 Mar 2001 00:53:20 +0000
Subject: Re: Finding existence of a value in a table
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43741@lists.php.net to get a copy of this message
try select count(fieldvaluein) from FROM TableOfInterest WHERE FieldValueIn=ValueOfInterest You don't need the GROUP if you just want the count - from your post and title, it sounds like you just want to know if a value exists in the table. You don't need to know what the value IS, because you're testing for it in the first place, right? The first value (only value!) back from that query will be a number between 0 and how ever many rows match the query. Dennis Gearon wrote: > I would like to return ONE ROW if possible from a query that would tell > me > whether a value exists in a table. I've tried: > > SELECT FieldValueIn, COUNT(*) FROM TableOfInterest WHERE > FieldValueIn=ValueOfInterest GROUP BY FieldValueIn; > > I can't seem to figure out how to test the return results to see if > there is no > rows with that value. Any help soon would be very nice. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#43741) next »