I have a sql like this and it works
select col1,col2,'Y' from tab1, tab2
where tab1.col1=tab2.col3
group by col1,col2
But I want to add CASE to determine 'Y', like this
select col1,col2,
case when tab2.col5='05' THEN 'Y'
ELSE 'N' from tab1, tab2
where tab1.col1=tab2.col3
group by col1,col2
Looks like I need to add COL5 in the group by. Is there any way I can avoid adding the col5 in to the group by.
Thanks in advance,
select col1,col2,'Y' from tab1, tab2
where tab1.col1=tab2.col3
group by col1,col2
But I want to add CASE to determine 'Y', like this
select col1,col2,
case when tab2.col5='05' THEN 'Y'
ELSE 'N' from tab1, tab2
where tab1.col1=tab2.col3
group by col1,col2
Looks like I need to add COL5 in the group by. Is there any way I can avoid adding the col5 in to the group by.
Thanks in advance,