sql server 2008 - How to produce null field using select statement -


i have query specified below.

  select distinct a.item_name, b.item_rate, b.professional_charge, c.discount , c.discount_type,  a.dept_id, c.discount_applicability  item_m  left outer join rate_m  b on a.item_code = b.bill_item   left outer join discount_m c on a.item_code = c.item_code  a.item_code = 'abs002' , b.rate_cat_id = 'dlx' ,   c. pay_type_id='bd' 

below output suggest item_code ‘abs002’ rate cat_id is’dlx’ , pay_type_id ‘bd’.

item_name item_rate professinal_charge discount discount_type dept_id  discount_applicability     absess i&d  440      null               0                p       cbn     1        

let assume item_code abs002 doesn’t contain rate_cat_id , pay_type _id ouput headers displayed no values.that perfect query execution.but requirement if above condition arises need output like.

  item_name item_rate professinal_charge discount discount_type dept_id  discount_applicability     absess i&d  null      null               null                null       null     null 

the time headers should displayed when item_code not present in item_m table appreciated


Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -