Stuck on query

Results 1 to 2 of 2

Thread: Stuck on query

  1. #1
    Join Date
    Dec 1969

    Default Stuck on query

    I have two tables.<BR><BR>One Orders table has orders, with a ShipTo and a BillTo<BR><BR>The Address table as addresses. The full address is listed, with an ID representing this address. <BR><BR>So it would be like this: <BR>Orders_Table:<BR><BR>Order_Number &#124 Order_Date &#124 BillTo &#124 ShipTo<BR>-------------------------------------------<BR>1000 11/1/2002 123 124<BR><BR>And in the address table it would be:<BR><BR>Address &#124 AddressID<BR>-------------------<BR>Blah 123<BR>Blah2 124<BR><BR><BR>So... I need to query for both addresses. I don&#039;t know how to do this. <BR><BR>Select Address From Address Where Address.AddressID = Orders.ShipTo AND Address.AddressID = Orders.BillTo<BR><BR>Will not work because it will only return records where both are the same. <BR><BR>I&#039;m stuck and confused!!! Please help me<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Join twice to same table...

    Select A1.Address, A2.Address <BR>From Address AS A1, Address AS A2, Orders<BR>WHERE A1.AddressID = Orders.ShipTo <BR>AND A2.AddressID = Orders.BillTo<BR><BR>etc.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts