General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Need advice on a tricky query
Greetings,
To integrate with our UPS system requires using ODBC to our VFP databases and specifying the query required to pull sales order and customer data to populate the shipping address.
The "simple" query that works looks like this...
SELECT somast.sono, somast.orddate, arcust.company, arcust.contact, arcust.address1, arcust.address2, arcust.city, arcust.state, arcust.zip, arcust.phone from arcust, somast where arcust.custno = somast.custno and sono = ?vp_sono
Now here comes the rub... When the somast record contains an "X" in the field "tosw", the customer address is pulled from an entirely different table, soaddr, instead of the arcust table. All the fields in the other table are the same except that the soaddr table also contains the sono so each sales order can have a different shipping address. I'm just not sure how to get a single query (as required by the UPS system through ODBC) that will return the correct address depending on the "X" (or no "X") in the "tosw" field in somast.
Any suggestions?
Greg
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only