Welcome to WebmasterWorld Guest from 54.144.3.134

Forum Moderators: open

Message Too Old, No Replies

A question about selecting data from joined tables.

     
4:29 am on Dec 8, 2010 (gmt 0)

Full Member

5+ Year Member

joined:June 30, 2008
posts: 318
votes: 0


Hi all,

You join two tables, such as a United States and a Canadian postal code table, where each has a PostalCode field.

I know that you can "SELECT us.PostalCode, ca.PostalCode from us JOIN ca ON whatever".

The question is...

Can i "SELECT PostalCode from us JOIN ca ON whatever"? In other words, can i have the query dump all the postal codes from both tables into the single results field array?
2:55 pm on Dec 8, 2010 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12541
votes: 1


Sounds like a job for UNION. I don't know which database you are using, but here is the MySQL man page for UNION Syntax, should get you started in the right direction.
[dev.mysql.com...]