- Moderator
- #1
I am building a pretty large query that builds an XML table to be imported into our accounting system.
One of the things that I need to do, however, is to select the tax table for the accounting system and include it in my results.... so for example, I need to do something like this:
So, I use a stored procedure instead of a JOIN because not every city and/or state is going to be in there, and the stored procedure returns a default value. So, to recap, when I select the city and state from the main record, I need to sub-query the tax table from another table, based on the information that I just got from the main query.
Any thoughts?
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg
One of the things that I need to do, however, is to select the tax table for the accounting system and include it in my results.... so for example, I need to do something like this:
Code:
SELECT CustomerName, ShipToAddress, ShipToCity, ShipToState, (SELECT TAXTableID from sp_LookupTax ShipToCity, ShipToState) AS TaxTableID, bla bla joins etc.
So, I use a stored procedure instead of a JOIN because not every city and/or state is going to be in there, and the stored procedure returns a default value. So, to recap, when I select the city and state from the main record, I need to sub-query the tax table from another table, based on the information that I just got from the main query.
Any thoughts?
TIA!
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg