I don't know you table structure but something like this would do it...

SELECT * from QB as tbl1
JOIN relAB as tbl2
ON tbl2.A=tbl1.A
where tbl2.a='a1'

Butch Bean

-----Original Message-----
From: Egor Egorov [mailto:[EMAIL PROTECTED]]
Sent: Saturday, February 09, 2002 7:24 AM
To: [EMAIL PROTECTED]
Subject: is possible 1 query with 2 selects?


Nuno,

Friday, February 08, 2002, 11:04:51 PM, you wrote:


NT>   Hello to all,

NT>   I'm trying to make a query with only one command but I can't see how
to do
NT>   it.

[skip]

NT>   What I want to do is get a list from table QB related to an item from
NT>   table QA:

NT>         For example, get a list from QB related to item 'a1':

NT>         1. select B from relAB where A='a1';

NT>         (result: b2, b3, b4)

NT>         2. select * from QB where ref in ('b2','b3','b4');

NT>         (result: only 'a1' related items)

NT>   There is a way of make this query with only one command?

NT>   Something like:

NT>         1. select * from QB where ref in (select B from relAB where
A='a1');

MySQL doesn't curently support sub-selects, look at:
      http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html

It is in our plans to support sub-selects in future:
      http://www.mysql.com/doc/T/O/TODO_MySQL_4.1.html

NT>   Please help me in this matter.
NT>   Thanks very much,





--
For technical support contracts, goto https://order.mysql.com/
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



---------------------------------------------------------------------
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

Reply via email to