Results 1 to 2 of 2

Thread: SQL Query Doubt

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: SQL Query Doubt

    Hi
    I have attached my DB here http://img577.imageshack.us/img577/7411/91186699.png

    Here is the query i am trying now.

    //////
    select * from (
    select 'SUBMITED' AS STATUS, count(*) As NO,BPDLOCATION from BEST_PRACTICE_DETAILS bpd,LOCATION_MASTER lm,STATUSCODES sc
    where bpd.BPDLOCATION = lm.LOCATIONNAME AND sc.STATUSID=bpd.BPDSTATUS AND sc.STATUSCODE='HODAPPROVE' group By BPDLOCATION
    UNION ALL
    select 'PICKED' AS STATUS, count(*) AS NO,BPDLOCATION from PROJECT_IMPLEMENTATION pimp,BEST_PRACTICE_DETAILS bpd
    where bpd.BPDID=pimp.BPDID group BY BPDLOCATION
    UNION ALL
    select 'IMPLEMENTED' AS STATUS, count(*) AS NO,BPDLOCATION from PROJECT_IMPLEMENTATION pimp,BEST_PRACTICE_DETAILS bpd
    where bpd.BPDID=pimp.BPDID AND PMDID IN ( select DISTINCT(PMDID) from PROJECT_CLOSURE) group BY BPDLOCATION
    ) AS f order by f.BPDLOCATION,f.STATUS

    ///////


    and i am getting the required details based on that. now my intention is to get those all details by specifying operation name from Operation tale. (wanna to use where there .)

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    please explain how the operations table is related to (any of) the tables that are currently in your query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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