Re: queue select

2006-07-10 Thread Joerg Bruehe

Hi!

Vittorio Zuccalà wrote:

Hello,
i've two tables and they have the same field.
I'd like to make a select which take records in a table and after it
shows record in the other table


Read here:  http://dev.mysql.com/doc/refman/5.0/en/union.html



in the same field...


It cannot be "the same", as it belongs to a different table.
In your example, both tables use the same name for one field, but for 
"Union" this is not required - all that is needed is that the result 
columns of the SELECTs that are combined into the UNION be compatible, 
so that a common result type can be set.




I try to explain:

Table1
FieldA - FieldB
AAA123 - Cellular
BBB111 - PostIt

Table2
FieldA - FieldH
AAB111 - Dido
BGF145 - Serp

My select has to show:
AAA123
BBB111
AAB111
BGF145

Is there a way for it?


Try this:
  SELECT FieldA FROM Table1 UNION SELECT FieldA FROM Table2


Happy reading!
Joerg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
Office:  (+49 30) 417 01 487 VoIP: [EMAIL PROTECTED]

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: queue select

2006-07-10 Thread Addison, Mark
From: Vittorio Zuccalà  Sent: 10 July 2006 14:26
> 
> Hello,
> i've two tables and they have the same field.
> I'd like to make a select which take records in a table and after it
> shows record in the other table
> in the same field...
> 
> I try to explain:
> 
> Table1
> FieldA - FieldB
> AAA123 - Cellular
> BBB111 - PostIt
> 
> Table2
> FieldA - FieldH
> AAB111 - Dido
> BGF145 - Serp
> 
> My select has to show:
> AAA123
> BBB111
> AAB111
> BGF145
> 
> Is there a way for it?
> Thanks!!

Sounds like you need a UNION query:

SELECT FieldA FROM Table1 UNION SELECT FieldA FROM Table2;

hth,
mark
--
 





MARK ADDISON
WEB DEVELOPER

200 GRAY'S INN ROAD
LONDON
WC1X 8XZ
UNITED KINGDOM
T +44 (0)20 7430 4678
F 
E [EMAIL PROTECTED]
WWW.ITN.CO.UK
Please Note:

 

Any views or opinions are solely those of the author and do not necessarily 
represent 
those of Independent Television News Limited unless specifically stated. 
This email and any files attached are confidential and intended solely for the 
use of the individual
or entity to which they are addressed. 
If you have received this email in error, please notify [EMAIL PROTECTED] 

Please note that to ensure regulatory compliance and for the protection of our 
clients and business,
we may monitor and read messages sent to and from our systems.

Thank You.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



queue select

2006-07-10 Thread Vittorio Zuccalà
Hello,
i've two tables and they have the same field.
I'd like to make a select which take records in a table and after it
shows record in the other table
in the same field...

I try to explain:

Table1
FieldA - FieldB
AAA123 - Cellular
BBB111 - PostIt

Table2
FieldA - FieldH
AAB111 - Dido
BGF145 - Serp

My select has to show:
AAA123
BBB111
AAB111
BGF145

Is there a way for it?
Thanks!!

-- 
vittorio zuccalà
Finconsumo Banca SPA
[EMAIL PROTECTED]
Tel: 011-6319464



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]