View Full Version : Mysql Query
Stasik
11-13-2001, 12:35 PM
Hey
i use this
SELECT email FROM user LEFT JOIN xxx USING (userid) WHERE $condition AND adminemail=1
it works fine, but i`m getting more then 1 match from table xxx, BUT i want just 1 match..... :(
Stasik
11-13-2001, 12:38 PM
i`m trying to make it in 2 querys.... but its interesting to make it in 1 query :D
Admin
11-13-2001, 12:52 PM
What is $condition?
Stasik
11-13-2001, 01:03 PM
like 1=1 AND stuff=1
there will be more than 1 match
Admin
11-13-2001, 01:12 PM
$result=$DB_site->query_first(" ... ");
will give you the first result.
OR use LIMIT:
SELECT email FROM user LEFT JOIN xxx USING (userid) WHERE $condition AND adminemail=1 LIMIT 1
Stasik
11-13-2001, 01:22 PM
you dont understand it :(
SELECT email FROM user LEFT JOIN xxx USING (userid) WHERE $condition AND adminemail=1
this gives me many times the same email because there are more then 1 match in xxx table
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.