Hi
i have 2 tables
the query that i have written is
select distinct mm.subscriber_id,count(mh.seq_memb_id),mm.PREV_SUB SCRIBER_ID,mm.subscriber_id,mm.DATE_OF_BIRTH,mm.ge nder,decode(mh.elig_status,'Y','YES'),decode(mh.el ig_status,'N','NO')
from hsd_member_master mm,hsd_member_elig_history mh
where mm.seq_memb_id = mh.seq_memb_id
and mm.seq_memb_id in (20621,20622,20623)
group by mm.subscriber_id,mh.seq_memb_id,mm.PREV_SUBSCRIBER _ID,mm.subscriber_id,mm.DATE_OF_BIRTH,mm.gender,mh .elig_status
my result should be
subscriber_id,PREV_SUBSCRIBER_ID,DATE_OF_BIRTH,gen der,no of 'yes' in elig_status,no of 'no' in hsd_member_elig_history.
there is multiple rows for each seq_memb_id in eliDo not use DISTINCT with GROUP BY ;)|||Hi
You are grouping by mh.seq_memb_id but it is not contained in the select clause (except as part of an aggregate function). This looks like a likely candidate for your problem
HTHsql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment