SQLTeam.com | Weblogs | Forums

Indication of column value add to the display

In this code, the results are: In our case, I would like to know which row does not have a 1 in the column is_primary_mo, in our case TANNE I would want a column 'NP'

last_name first_name is_primary_mo street_address_1
8712 BANTT 1 Center 1
8712 BANTT 0 Center A

|8713|TANNE|0|Center 2|
|8713|TANNE|0|Center 5|

select b.last_name, b.first_name, a.is_primary_mo, a.street_address_1 from staff_office_demographics_byprimary_view a
inner join staff_view b
on a.staff_id = b.staff_id

Please provide your data with ddl and dml as asked in all your other questions

select b.last_name, b.first_name, a.is_primary_mo, CASE a.is_primary_mo WHEN 1 THEN 'NP' END AS FieldNameHere, a.street_address_1 from staff_office_demographics_byprimary_view a
inner join staff_view b
on a.staff_id = b.staff_id