Running SQL Server 2012 Express Scalar Function in View -


my sql guru in costa rica week , have problem don't know how solve. have 4 simple tables , 1 function. simplicity sake i'll remove fields not required understand need.

table1:

primary_item_id, inventory_item_id 

table2:

table2id, inventory_item_id, table3id 

table3:

table3id, department, departmentjobtype 

table4:

primary_item_id discrete_job 

the function returns jobtype of job table4's discrete_job column.

what need: see inventory_item_id's table1. show department when jobtype table3 equal result function.

the links like..

    table1.inventory_item_id -> table2.inventory_item_id  , table1.primary_item_id = table4.primary_item_id     table2.table3id -> table3.table3id when      table3.departmentjobtype = (select getjobtype_f(table4.discrete_job) 

i'm hoping can have , not need redesign tables. (i realize if had jobtype in table1 wouldn't need avoid changing tables as possible. awesome! other gurus!

i resolved issue using cte query. thanks.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -