Results 1 to 3 of 3

Thread: iterative SQL

  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Question Unanswered: iterative SQL

    How can I run the following query for each day of March iteratively in single shot ?

    select upper(substr(client_id,0,5)) Call_Center, round(avg(elapsed_time),2)/1000 Avg_Time_Seconds, count(*) Txns_Count
    from cc_client_metrics, onstar_site
    where cc_client_metrics.ONSTAR_SITE_ID = onstar_site.onstar_site_id
    and cc_client_metrics.create_timestamp >= to_date('20100301000000','YYYYMMDDHH24MISS')
    and cc_client_metrics.create_timestamp <= to_date('20100301235959','YYYYMMDDHH24MISS')
    and metrics_id = '1'
    group by upper(substr(client_id,0,5));

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    one way is to write SQL to write the 30 or so desired SELECT statements
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Select the entire month of March and group by date?

Posting Permissions

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