where should i put update with this count function?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lili
    New Member
    • Oct 2011
    • 1

    where should i put update with this count function?

    hello,

    i have these queries in oracle:
    the first one i made it to get the count, and it is working. but when i try to run the second query in order to put records in count (*) to a.count it is gave me errors. also, a.count column is an empty column i wana transfer record from that logical count (*) to a.count.

    Code:
    select count (*), a.start_msisdn, a.end_msisdn,a.quantity, a.count
    from TMP_MSISDN a, dbdev.subscribers b
    where b.msisdn between a.start_msisdn and a.end_msisdn
    group by a.start_msisdn, a.end_msisdn,a.quantity, a.count

    Code:
    UPDATE tmp_msisdn a  
    SET a.count =  ( select count (*)
    from TMP_MSISDN a, dbdev.subscribers b
    where b.msisdn between a.start_msisdn and a.end_msisdn
    group by a.start_msisdn, a.end_msisdn,a.quantity)
    WHERE EXISTS
      ( select count (*)
        from TMP_MSISDN a, dbdev.subscribers b
       where b.msisdn between a.start_msisdn and a.end_msisdn
    group by a.start_msisdn, a.end_msisdn,a.quantity);
    Attached Files
    Last edited by Frinavale; Oct 12 '11, 07:20 PM. Reason: Added code tags. Please post code in code tags.
Working...