SQL question
william humphrey
shoreagent at gmail.com
Fri Oct 10 15:53:40 CDT 2008
I have a problem with SQL that I hope you can help me with.
I have one table "my_clients" which which has a field "clients" and another
field "client_ID"
I have another table "bill_of_ladings" which has two fields "shipper" and
"consignee" the contents of these two fields are a "client_ID" number. There
are two links one called "shippers" for the shipper field and one called
"consignees" for the consignee field.
The following SQL works fine:
select clients as shipper from my_clients join info_billoflading on shippers
And the following SQL works fine:
select clients as consignee from my_clients join info_billoflading on
consignees
But what I want is
select clients as consignee, clients as shipper from my_clients join
info_billoflading on consignees join info_billoflading on shippers (and this
SQL does not work)
The only way I can get it to work is a complicated "union":
------
select clients as shipper from my_clients join info_billoflading on shippers
union
select clients as consignee from my_clients join info_billoflading on
consignees
----
But the problem with the union as the result is in all one column and I want
it in two columns. Can you help?
Thanks
Bill
More information about the Valentina
mailing list