You need to do a join ... SELECT T.* FROM transport AS T, acl AS A WHERE T.id=A.id AND A.adminId='1'
--Joe -- Joe Stump <[EMAIL PROTECTED]> http://www.joestump.net -----Original Message----- From: news [mailto:[EMAIL PROTECTED]]On Behalf Of Max Clark Sent: Wednesday, December 11, 2002 10:26 AM To: [EMAIL PROTECTED] Subject: Newbie- Help with query Help! I am a new mysql user, I understand the basic syntax of the commands for different sql queries. I am trying to write a query and I can't seem to figure it out. I would like to select all domain,transport fields from the transport table where the transport id = a query agains the acl table (select transportId from acl where adminId='1'). When I try this I get a sql error, what do I need to do differently? Thanks in advance, Max mysql> describe transport; +-----------+----------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-----------+----------------------+------+-----+---------+----------------+ | id | smallint(5) unsigned | | PRI | NULL | auto_increment | | domain | char(50) | | UNI | | | | transport | char(50) | | | | | +-----------+----------------------+------+-----+---------+----------------+ 3 rows in set (0.01 sec) mysql> describe acl; +-------------+----------------------+------+-----+---------+--------------- -+ | Field | Type | Null | Key | Default | Extra | +-------------+----------------------+------+-----+---------+--------------- -+ | id | smallint(5) unsigned | | PRI | NULL | auto_increment | | adminId | smallint(5) unsigned | | | 0 | | | transportId | smallint(5) unsigned | | | 0 | | | securityId | smallint(5) unsigned | | | 0 | | +-------------+----------------------+------+-----+---------+--------------- -+ 4 rows in set (0.00 sec) --------------------------------------------------------------------- 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