Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2003
    Location
    Washington DC area
    Posts
    1,770

    Cool Unanswered: Adding count to the script

    CREATE OR REPLACE VIEW PURIDIOMUSER.DELTEK_PROJ_SETUP ( PROJ_ID, PROJ_NAME, PROJ_ABBRV_CD, ORG_ID, CUST_ID, ACTIVE_FL, PROJ_START_DT, PROJ_END_DT, PRIME_CONTR_ID, SUBCTR_ID, DMS_DPS_CD, COMPANY_ID )
    AS
    SELECT distinct T1.PROJ_ID, T1.PROJ_NAME, T1.PROJ_ABBRV_CD, T1.ORG_ID, T1.CUST_ID, T1.ACTIVE_FL, T1.PROJ_START_DT, T1.PROJ_END_DT, T1.PRIME_CONTR_ID, T1.SUBCTR_ID, T1.DMS_DPS_CD, T1.COMPANY_ID FROM DELTEK.VPJ_PROJ_SETUP T1


    I need to add count to result. I tried select count(*)

  2. #2
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    .. and what happened when you tried it ?

    try adding count( * ) over( )

  3. #3
    Join Date
    Dec 2003
    Posts
    1,074
    Look into aggregate queries in the documentation. In your case, you're either going to need to either:

    - add a GROUP BY clause to your main query, or
    - add an inline view which performs the count(*), and relate that data back to the main query, or
    - use analytical functions, if the version of your DB supports those. This is my preferred method

    ---=Chuck

Posting Permissions

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