I did not know you could do a SELECT inside a SELECT. Very nice!
Thank you Andrew. And I take it ASC is "in ascending order"?
So to do descending order I'd put DES or DEC? Just curious about that
one.
Thanks again.
Best,
Karl
On Jan 21, 2011, at 4:48 AM, Andrew Holt wrote:
Hi Karl,
What about:
$q = "SELECT username, userlevel, email, timestamp FROM Users_Table
WHERE username IN (SELECT username from VIP_Table) ORDER BY
username ASC";
This performs a query on the VIP table to get the usernames and
then gets the username, userlevel, email and timestamp from the
Users table if the username is in this result.
There are some tutorials which I often refer to when I need a
refresh (not all programming in my job unfortunately!):
http://www.tizag.com/mysqlTutorial/
http://www.w3schools.com/sql/default.asp
Hope this helps!
Andrew
-----Original Message-----
From: Karl DeSaulniers [mailto:karl@xxxxxxxxxxxxxxx]
Sent: 21 January 2011 01:02
To: php-db@xxxxxxxxxxxxx
Subject: Getting Results
Hello,
Can anyone tell me if I am doing this right? Or how to do this right?
Not sure on what to search for. What the search term would be for
this type of call to the database.
$q = "SELECT username,userlevel,email,timestamp FROM ".USERS." ORDER
BY username FROM ".VIP." ";
I am basically trying to get a list of user info from the user table
based on the usernames that are in the vip table.
TIA,
Karl DeSaulniers
Design Drumm
http://designdrumm.com
Karl DeSaulniers
Design Drumm
http://designdrumm.com
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php