MySQL Forums
Forum List  »  Newbie

SQL Question - Join Full example given
Posted by: Matt S
Date: May 26, 2005 12:33PM

Mysql 4.0.24 (Blast! no sub-queries)

I am working with a normalized database structure and I am having a problem putting a query together. Below is an example of the table layout:

clients
clientId | name
4 | test client
12 | other client

address
addressid | clientid | address1 | address2 | city | state | zip
2 | 4 | 1313 mb | po box 12| boca | Fl | 33428
5 | 12 | 588 tree rd| apt #2 | raton | Fl | 33060
10 | 4 | 23123 sr4 | NULL | delray | Fl | 33481
13 | 12 | 2512 NE 7av| POBOX 52 | Meyers | Fl | 33338

order
orderid | clientid | ordernum
23 | 4 | 4531345
55 | 12 | 4
62 | 12 | 8192
493 | 4 | 19531345

Results:
clientId | name | addressid | address1 | address2 | city | state | zip | ordernum
4 | test client | 10 |23123 sr4 |po box 312| delray | Fl | 33484 | 19531345
12 | other client| 13 |2512 NE 7av| POBOX 52 | Meyers | FL | 33338 | 8192

I am trying to figure out how I can get the above results in a single query without using a subquery since I am using mysql < 4.1.

I have been trying everything that I know, and I have not gotten anywhere.

Thanks,

Matt

Options: ReplyQuote


Subject
Written By
Posted
SQL Question - Join Full example given
May 26, 2005 12:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.