Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Sql Query

$
0
0

In a "many to many" relationship I create a "intermediate" table to control the "many" side of the tables. In my design I have the "action" table and the "condition" table. And "many" actions can have "many" conditions and there is the "action condition" table. In the "action" table, I have a column named "signature number" it is a number assigned to each of the action, also on the "condition" table I have the "sql function name" and "condition weight" column and the condition weight is assigned with a unquie binary number, the "sql function name" is the name of the sql function to test that condition. When it executes it will pass a "customer id " to this sql function to test the condition, at the end of the function it will return either '0" or the  "condition weight" number for that condition and the "sum" of all the "condition weight", if all pass, will be the "signature number" for that action in the action table. I need to construct to loop thru all the "conditions" on each of the "action" on the "intermediate" table with the parameter of the "customer id" passing to it. Performance of this query meed to be considered as it will run as a agent job to test on a customer table with 200,000 customers. There are over 10 actions and each action can have up to 8 conditions to determine. Thanks


Kahlua


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>