Results 1 to 3 of 3

Thread: need sql query

  1. #1
    Join Date
    Oct 2005
    Posts
    21

    Unanswered: need sql query

    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 eli

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool


    Do not use DISTINCT with GROUP BY
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    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

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •