Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2012

    Unanswered: How would I merged and display a serpare query into one

    I am trying to merge 3 queries I have done into one. I have two of them running, but how do I get a row for "Reprints_with_Trend" that would calculate with timetrend too (*1440>5) statement for only values with over 5 minutes as the 5 columns.

    Select employees, siteid,sum(num_REPRINTS) AS NUMTIMES_CASHREPRINTED_ALREADY,--Reprints_With_TimeTrend,
    Select al.fastlane_login_username AS flusers, al.fac_idu AS SiteID, to_CHAR(attempt_date_time,'YYYY-MM-DD') as Dates,
    COUNT(*) as NUM_REPRINTS--Count (attempt_date_time) as Reprints_With_TimeTrend
    FROM Table_Names1 Inner Join Table_Names2
    WHERE attempt_date_time >=
    '1-May-2012'--TO_DATE (:dtstart, 'mm/dd/yyyy hh24:mi:ss')
    AND (attempt_date_time <= '31-May-2012'--TO_DATE (:dtend, 'mm/dd/yyyy hh24:mi:ss')
    And (pm.payment_method_desc = 'Cash')
    --AND ((al.attempt_date_time - th.time_out) * 1440) > 5
    Group by al.fastlane_login_username , al.fac_idu , to_CHAR(al.attempt_date_time,'YYYY-MM-DD')
    GROUP BY flusers, siteid --Reprints_With_TimeTrend
    Order by sum(num_Reprints) desc

    How would I get "Reprints_With_TimeTrend" to display on a new column with "attempt_date_time - th.time_out) * 1440) > 4.3
    " only affecting that columns.
    Last edited by SQLNoob8; 06-15-12 at 13:13.

  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    I find the posted code to be effectively unreadable.
    When I paste the posted SQL into my formatter, it reports it contains invalid syntax.

    what is to be gained by combining 3 queries into one?

    How will you, I or anyone recognize any post SQL response as being correct?
    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 2012
    Maybe is because of all the Tables names or I removed alot of the tables_name and Inner Join

    We just want to run a query and display the three result we want.

    So far, I can only get it to display two of them

    without ((attempt_date_time - th.time_out) * 1440) > 5

    calculating into the other *Count

Posting Permissions

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