In t-sql 2008 r2, I am trying to determine how to setup the sql to accomplish the following
goal:
select table1.customer_id,type,start_date,end_date,Program_id from table1
join table2 on table1.customer_id = table2.customer_id
1. where type not= ('aa','cc') and type not = 'g2' where code = 3
In table1 there are lots of records for each customer_id and there can be
lots of various values for type. I only want the customer_ids that do not contain
the values listed above.
and
2. table2 has only one customer_id. Customer_id is the key of table2.
I want customers that do not have a value in one of the 3 columns:
start_date, end_date, and program_id.
Both parts 1 and 2 listed above need to be true for the customer_id to be selected.
Thus can you tell me how to setup that sql?