October 24, 2005 at 4:08 pm
I am faced with the need to query the price of parts from a 3 table join. The problem is the number of parts that need to be queried at one time; 10 to 100 parts. That would make for a very messy WHERE clause. I am wonder if there is a better strategy?
If it matters, I am using VB.NET.
Thanks
--Rob
October 24, 2005 at 4:17 pm
Why not stick the part numbers to be queried in a temp table and make it a 4 table join?
October 24, 2005 at 4:19 pm
OK. That's one I didn't think of. Thanks for the idea!
October 24, 2005 at 4:19 pm
Is the SQL in a stored procedure ?
There are some alternatives:
1. Pass the part numbers as a single string as either fixed positions or delimited. See http://www.sommarskog.se/arrays-in-sql.html for how to convert the string into a table.
2 Pass the part numbers as XML and then convert to a table
With either solution, you would finaly have a temporary table with one row for each part number that you would join to the existing SQL.
SQL = Scarcely Qualifies as a Language
October 24, 2005 at 9:52 pm
Why not make a 4th table that would keep the kits, and then do the sum based on a kit?
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply