How to Write Conditional Statement in SQL Server -
i having logic issue in relation querying sql database. need exclude 3 different categories , item included in categories; however, if item under 1 of categories meets criteria category need keep said item.
this example output after querying database @ current version:
exampledb | item_num | pro_type | area | description 1 | 45kx-76y | flcm | finished | coil8x 2 | 68wo-93h | flcl | similar | y45kx 3 | 05rh-27n | fldr | finished | kh72n 4 | 84oh-95w | flep | final | tar5x 5 | 81rs-67f | flep | final | tar7x 6 | 48yu-40q | flcm | final | bile6 7 | 19vb-89s | fldr | warranty | exp380 8 | 76cs-01u | flcl | gator | low5 9 | 28oc-08z | flcm | redo | coil34y item_num , description in table together, , pro_type , area in 2 separate tables--a total of 3 tables pull data from.
i need construct query not pull item_num area equal to: finished, final, , redo; need pull in item_num meets type criteria: flcm , flep. in end query should this:
exampledb | item_num | pro_type | area | description 1 | 45kx-76y | flcm | finished | coil8x 2 | 68wo-93h | flcl | similar | y45kx 3 | 84oh-95w | flep | final | tar5x 4 | 81rs-67f | flep | final | tar7x 5 | 19vb-89s | fldr | warranty | exp380 6 | 76cs-01u | flcl | gator | low5 7 | 28oc-08z | flcm | redo | coil34y
try this:
select * table join... area not in('finished', 'final', 'redo') or type in('flcm', 'flep')
Comments
Post a Comment