Getting duplicates in Case  and Count clause in Report Generation

Hi all,
let me explain the Base first (just the Section which is in the scope of this code )then ill go to code and my problem.i have a Set of Pre-defined Tasks in *"TASK"* Table.i have a system which will provision the User Request by allotting the Particular Task to their Request.Each Request will mapped to the Instance of the (Pre-defined)Task, this will be maintained in a separate table *"TASK_INSTANCE"* against the user request id. Each task has a pre-defined duration.and their date of completion date will be stored in column of data type Time Stamp.
My scenario is i need to generate report based on the completion date.report requirement is , i need to give the count of tasks which having completion date as today,tomorrow and next day they grouped based on Task Names.
my problem is, im getting duplicates though i used the Distinct.There is no possible of duplicates by means of join, since im using group by task name.each Record in the Task_instance table has direct relation to the Task ID. For eg : im getting one row with the count satisfying the Condition and next row with empty set.i cant figure it out why happening.need your help in figuring out this.
Let me append the query below,
SELECT   task.task_name,
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-1)
THEN
*(COUNT (task_instance.ptd_pdd_date))*
END)
AS "1_day_behind",
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-2)
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "2_day_behind",
*(CASE*
WHEN ( (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)) =
-3)
THEN
COUNT (task_instance.ptd_pdd_date)
END)
AS "3_day_behind"
FROM   task, task_instance
WHERE       task.task_id = task_instance.task_id
AND task_instance.status_id = 1
AND task_instance.ptd_pdd_date IS NOT NULL
GROUP BY   (TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date)),
task.task_name;
task_instance.status_id = 1 it refers to the task which are in "IN PROGRESS" state.
This is the (Sample) result set i am getting.In this, the task UI_Contact_Customer is repeated three times. with different count in separate rows and null in separate row .i need to avoid those duplicates.please advise.
TASK_NAME     | "1_DAY_BEHIND"     | "2_DAY_BEHIND"     | "3_DAY_BEHIND" |
______________________________|________________|_________________|_________________|               
UI_Conduct_Fiber_Plant_Survey_____|________________|________________ |_________________|
UI_Conduct_Site_Survey__________ |_______________ |________________ |_________________|
UI_ConductFiberSurvey_C___________|________________|________________ |________________|
UI_ConductSiteSurvey_C __________|________________|_________________|_________________|
UI_Contact_Customer_____________|________________|_________________|_________________|
UI_Contact_Customer ____________ |_______10_______|________________ |_________________|
UI_Contact_Customer_____________|________________|_______ 12_______|_________________|
UI_Create_Account_Equip_C_______ |________________|_________________|_________________|
UI_Create_Account_Equipment_____ |________________|_________________|_________________|
UI_Create_CM_Ticket           |     | | |
______________________________|________________|_________________|_________________|
In the Above result set, especially UI_Contact_Customer task,ten of their instance having completion date tomorrow and 12 instance having next day as completion date. i need get all those as single row without any duplicates.
Thanks,
Jeevanand.K

hey super dude,
it really works fine.matching my requirement exactly.
My hearty appreciation to you friend, and a small appreciation for me tooo,because i formed the base query. :-)
i used the below query,it requirement gets completed.
A big Thanks for your super fast Response
SELECT   task.task_name,
COUNT(CASE
WHEN TRUNC (SYSDATE) - TRUNC (task_instance.ptd_pdd_date) BETWEEN 1
AND  14
THEN
*1*
END)
AS "TWO weeks older",
COUNT(CASE
WHEN TRUNC (SYSDATE) - TRUNC(task_instance.ptd_pdd_date) =
-1
THEN
*1*
END)
AS "1_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -2)
THEN
*1*
END)
AS "2_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -3)
THEN
*1*
END)
AS "3_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -4)
THEN
*1*
END)
AS "4_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -5)
THEN
*1*
END)
AS "5_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) = -6)
THEN
*1*
END)
AS "6_day_left",
COUNT(CASE
WHEN ( (TRUNC (SYSDATE)
- TRUNC (task_instance.ptd_pdd_date)) >= -7)
THEN
*1*
END)
AS "After one week"
FROM   task, task_instance
WHERE   task.task_id = task_instance.task_id AND task_instance.status_id = 1
GROUP BY   task.task_name;
Thanks,
Jeevanand.K

Similar Messages

  • SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007

    Can you please help me to write an SQL Query to get Project Plan Name and Resource Name from Reporting database of Project Server 2007. Thanks!!

    Refer
    http://gallery.technet.microsoft.com/projectserver/Server-20072010-SQL-Get-a99d4bc6
    SELECT
    dbo.MSP_EpmAssignment_UserView.ProjectUID,
    dbo.MSP_EpmAssignment_UserView.TaskUID,
    dbo.MSP_EpmProject_UserView.ProjectName,
    dbo.MSP_EpmTask_UserView.TaskName,
    dbo.MSP_EpmAssignment_UserView.ResourceUID,
    dbo.MSP_EpmResource_UserView.ResourceName,
    dbo.MSP_EpmResource_UserView.ResourceInitials
    INTO #TempTable
    FROM dbo.MSP_EpmAssignment_UserView INNER JOIN
    dbo.MSP_EpmProject_UserView ON dbo.MSP_EpmAssignment_UserView.ProjectUID = dbo.MSP_EpmProject_UserView.ProjectUID INNER JOIN
    dbo.MSP_EpmTask_UserView ON dbo.MSP_EpmAssignment_UserView.TaskUID = dbo.MSP_EpmTask_UserView.TaskUID INNER JOIN
    dbo.MSP_EpmResource_UserView ON dbo.MSP_EpmAssignment_UserView.ResourceUID = dbo.MSP_EpmResource_UserView.ResourceUID
    SELECT
    ProjectUID,
    TaskUID,
    ProjectName,
    TaskName,
    STUFF((
    SELECT ', ' + ResourceInitials
    FROM #TempTable
    WHERE (TaskUID = Results.TaskUID)
    FOR XML PATH (''))
    ,1,2,'') AS ResourceInitialsCombined,
    STUFF((
    SELECT ', ' + ResourceName
    FROM #TempTable
    WHERE (TaskUID = Results.TaskUID)
    FOR XML PATH (''))
    ,1,2,'') AS ResourceNameCombined
    FROM #TempTable Results
    GROUP BY TaskUID,ProjectUID,ProjectName,TaskName
    DROP TABLE #TempTable
    -Prashanth

  • How to get data from an existing Excel file using report generation toolkit

    I'm trying to use the Excel Get Data vi from the report generation toolkit, but i can't figure out how to turn a browsable path into the right type for the VI.  I've tried using the New Report.vi, but that doesn't work unless you use a template.  It won't open an existing excel file and make it an open report to pull data from.
    Essentially, i have a bunch of excel files that have data in them and i want to use a VI to analyze the data.  So, i'm trying to pull in all the data directly from the excel file so i don't have to reproscess them all into text so i can use the more standard spreadsheet VIs.  But to even convert the excel file programtically in labview won't i still need to be able to open the excel file and get the data?
    Solved!
    Go to Solution.

    I C.
    Got it,
    the reason why I can view it using my Excel file because its in .CSV.
    I open Microsoft Excel to open .CSV file.
    But you can also open .csv file with notepad.
    So, you cannot open .xls with Read Spreadsheet File
    I learn something everyday
    Best regards,
    Krispiekream

  • How do I get all servers up and running for publishing reports

    I checked it and Adaptive Job Server is enabled and running. But Publication Job Server and Destination Job Server are not enabled. I read SAP Business Objects Enterprose Publisher's Guide and it says that they are mandatory. How do I get them enabled?
    I use BOE XI R3.

    You need to logon to the CMC (Central Management Console) with admin priviliges and go to the servers area. Her you can start/stop, enable and disable services. You should be able to find the services you are looking for. Make sure the are enabled and started.
    Hope this helps...
    Martijn van Foeken
    Focuzz BI Services
    http://www.focuzz.nl
    http://nl.linkedin.com/in/martijnvanfoeken
    http://twitter.com/mfoeken

  • How to get the job name and details in a report format - sm37 details I mea

    I need to extract the Job names and the job steps that comeout of a report?
    Is there a standard program for this ?
    Which tables store this information for me to write a custom report?
    thanks,
    Ven

    Hi Venkatabby,
    Check out the table:
    TBTCS
    Thanks,
    Chidanand

  • How to get Uniform distributed queue message counts with help of JMX

    Hi,
    Is there any way to get given queue message count, pending message counts using JMX. I can get all queue names and counts using JMX... after that i have to show only selected queue details.
    Thanks,
    -Som

    Hi,
    Following is the WLS snippet from an upcoming WLS JMS message management white paper that you can use to get the message statistics for a given destination.
    With appropriate command line parameters, this script can be used to poll and dump the statistics of any destination on a specified interval.
    Note that the WLST uses JMX API under the cover, so you can easily convert this into a pure JMX java program.
    Hope this helps.
    Kats
    WebLogic JMS Message Statistics Script for weblogic.WLST
    This script can be used for dumping message statistics of a given JMS Destination.
    Based on the arguments, the script creates can print out message statistics
    Usage: java weblogic.WLST msg_statistics.py [options]
    Options:
      username=...           username to connect to WebLogic Server       - defaults to "weblogic"
      password=...           password to connect to WebLogic Server       - defaults to "weblogic"
      url=...                Provider URL of the Administration Server    - defaults to "t3://localhost:7001"
      wlsServerName=...      WebLogic Server Name                         - defaults to "examplesServer"
      jmsServerName=...      JMS Server Name that hosts the destination   - defaults to "examplesJMSServer"
      jmsModuleName=...      JMS Module Name that defines the destination - defaults to "examples-jms"
      jmsDestinationName=... JMS Destination name to get the statistics   - defaults to "exampleQueue"
      pollingIntervalInSeconds=... Time interval between statistics dump  - defaults to "60 secs"
      redirectStdout=...     File name to redirect the stdout of WLST     - defaults to no redirect and the results wil be printed out to stdout.
      help                   Prints out this usage help
    Note that all the defaults are set based WebLogic Examples domain that is part of WebLogic Server installation.
    The "examples" server can be started from "C:/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server" using startWebLogic.sh
    To try this script OOTB, start the "examples" server and run the JMS sample as described below.
    cd :/Oracle/Middleware/wlserver_10.3/samples/domains/wl_server/bin
    . ./setDomainEnv.sh
    cd $WL_HOME/samples/server/examples/src/examples/jms/queue
    javac -d . *.java
    export CLASSPATH=".;$CLASSPATH"
    java examples.jms.queue.QueueSend t3://localhost:7001
    Follow the prompts to populate the queue
    Examples:
      msg_statistics.py - Dump the message statistics of the exampleQueue for every 1 min
      msg_statistics.py user=weblogic pass=weblogic url=t3://localhost:7001
                          wlsServerName=examplesServer jmsServerName=examplesJMSServer
                    jmsModuleName=examples-jms jmsDestinationName=exampleQueue
                    pollingIntervalInSeconds=30
    For more details on JMS Message Management using WLST, see "WebLogic JMS Message Management In a Nutshell" whitepaper.
    from weblogic.jms.extensions import JMSMessageInfo
    from weblogic.messaging.kernel import Cursor
    from javax.jms import TextMessage
    from javax.jms import DeliveryMode
    from java.io import ByteArrayOutputStream
    from java.io import StringBufferInputStream
    from java.util import Properties
    from java.util import Date
    from java.lang import *
    import jarray
    import sys
    # shows_messages() definition
    def dump_statistics(wlsServerName, jmsServerName, jmsModuleName, jmsDestinationName, pollingIntervalInSeconds):
      pollingIntervalInMillis = long(pollingIntervalInSeconds) * 1000L
      domainRuntime()
      cd ('ServerRuntimes')
      spath = wlsServerName + "/JMSRuntime/" + wlsServerName +".jms"
      cd (spath)
      fullDestName=jmsServerName+'/Destinations/'+jmsModuleName +'!'+jmsDestinationName
      cdPathForDestName='JMSServers/'+ fullDestName
      cd (cdPathForDestName)
      while 1:
        print "========================================================================================================================"
        print "Messages     Messages      Messages      Messages      Bytes        Bytes        Bytes           Bytes    "
        print "Current       Pending       High          Received      Current      Pending      High            Received "
        print "Count         Count         Count         Count         Count        Count        Count           Count    "
        print "========================================================================================================================"
        s = "%8d     %8d     %8d     %8d     %8d     %8d     %8d     %d" % (cmo.getMessagesCurrentCount(), cmo.getMessagesPendingCount(), cmo.getMessagesHighCount(), cmo.getMessagesReceivedCount(), cmo.getBytesCurrentCount(), cmo.getBytesPendingCount(), cmo.getBytesHighCount(), cmo.getBytesReceivedCount())
        print s
        print ''
        Thread.sleep(long(pollingIntervalInMillis))
    # Function to handle script arguments of the variety 'n=v', where
    # arguments are placed into a dictionary of nv pairs and returned
    # to the caller
    def argsToDict(args):
      d = {}
      for arg in args:
        #print "arg: " + arg
        pair = arg.split('=', 1)
        #print "pair: " + str(pair)
        if len(pair) == 2:
          # binary argument, store as key pair
          key = pair[0]
          val = pair[1]
          d[key] = val
        else:
          # Unary argument, story with empty (non-null) key
          d[arg] = ''
      print "Arguments: " + str(d)
      return d
    # Returns the value found in the provided map, at the location
    # specified by 'key'; if no entry exists in the map for 'key',
    # the provided default is returned.
    def getValue(dict, key, default=None):
      ret = default
      if dict is not None:
        try:
          ret=dict[key]
        except KeyError:
          pass
      return ret
    # Connect to the target server specified in the provide args
    def connectIfNecessary(argsDict=None):
      # connect if necessary
      if connected == "false":
        user=getValue(argsDict, "user", "weblogic")
        passwd=getValue(argsDict, "pass", "weblogic")
        url=getValue(argsDict, "url", "t3://localhost:7001")
        print "Connecting with [" + user + "," + passwd + "," + url + "]"
        connect(user,passwd,url)
    # Retrieve a positional argument if it exists; if not,
    # the provided default is returned.
    # Params:
    # pos   The integer location in sys.argv of the parameter
    # default  The default value to return if the parameter does not exist
    # returns the value at sys.argv[pos], or the provided default if necesssary
    def getPositionalArgument(pos, default):
      value=None
      try:
        value=sys.argv[pos]
      except:
        value=default
      return value
    # Main
    argsDict = argsToDict(sys.argv)
    redirectOutputFileName = getValue(argsDict, "redirectStdout")
    if redirectOutputFileName is None:
      pass
    else:
      redirect(redirectOutputFileName, 'false')
      print "The output from this program gets written into file " + redirectOutputFileName
      sys.stdout = open(redirectOutputFileName, "w")
    isHelp = getValue(argsDict, "help")
    if isHelp is None:
      pass
    else:
      print __doc__
      exit()
    connectIfNecessary(argsDict)
    wlsServerName = getValue(argsDict, "wlsServerName", "examplesServer")
    jmsServerName = getValue(argsDict, "jmsServerName", "examplesJMSServer")
    jmsModuleName = getValue(argsDict, "jmsModuleName", "examples-jms") 
    jmsDestinationName = getValue(argsDict, "jmsDestinationName", "exampleQueue")
    pollingIntervalInSeconds = getValue(argsDict, "pollingIntervalInSeconds", "60")
    dump_statistics(wlsServerName, jmsServerName, jmsModuleName, jmsDestinationName, pollingIntervalInSeconds)
    disconnect()
    print 'End of script ...'
    exit() 

  • Getting duplicate data records for master data

    Hi All,
    When the process chain for the master data, i am getting duplicate data records and , for that  selected the options in Info package level under processing 1)a  update PSA and subsequentky data targets and alternateely select the option Ignore double data records. But still the load was failing and error message "Duplicate  Data Records" after that rhe sehuduled the Info package then i am not getting the error message next time,
    Can any one help on this to resolve the issue.
    Regrasd
    KK

    Yes, for the first option u can write a routine ,what is ur data target--> if it is a cube, there may be a chances of duplicate records because of the additive nature.if its a ODS then u can avoid this, bec only delta is going to be updated.
    Regarding the time dependant attributes, its based on the date field.we have 4 types of slowly changing dimensions.
    check the following link
    http://help.sap.com/bp_biv135/documentation/Multi-dimensional_modeling_EN.doc
    http://www.intelligententerprise.com/info_centers/data_warehousing/showArticle.jhtml?articleID=59301280&pgno=1
    http://help.sap.com/saphelp_nw04/helpdata/en/dd/f470375fbf307ee10000009b38f8cf/frameset.htm

  • How can I get a free case like everyone else?

    I'm a 67-year-old grandmother who stood in line and upgraded to the iPhone 4 on June 29 so I could see my grandsons in another state when I talked to them on the phone. The only cases available when I bought the phone at the AT&T store were iFrogz. I assume this is one of the third party cases that Steve Jobs said won't get a refund? I spent the same amount of money that everyone else did, and now they will get a free case and I won't. Not fair.

    You can still get a free case, just not your money back for the one you have.
    Claim your new case and sell it on ebay if you don't want it.

  • Why is firefox crashing or closing on its own, I get plug-in crashes and unresponsive script warnings?

    Firefox is closing on its own or crashing for no reason. I've put in at least 4 crash reports a day. I'm also getting plug-in crashes and have sent those reports in. Also, I'm getting lots of unresponsive script warning messages. At first I thought it was Facebook but it is now doing it on GMail so is it Firefox?

    I am not sure I did this right. This is what I did: right-mouse clicked on the desktop, whent to properties, went to display properties, went to settings, clicked on advanced tab, and then clicked on troubleshooting tab. There I drug the hardware acceleration slider to the left to disable it, clicked ok twice as directed, restarted the computer and then I couldn't get firefox to open at all, but I went to internet explorer and got on you tube and tried to watch a video, but it crashed again.
    So I don't think that worked. I couldn't figure out how to disable hardware acceleration in the Flash plugin, but did it on the desktop instead. Are there different steps I need to take to accomplish this?
    Thank you!

  • In popup step how do I get the "text on the button" in the report rather than button index?

    (1)
    How do I configure the POPUP step in "SEQ MAIN.seq" to execute the second
    step (IS OUT PUT IS 20?) in "SEQ 1.seq" when "IS OUT PUT IS 20?" button
    hit and execute the third step (IS OUT PUT IS 30?) in "SEQ 1.seq" when "IS
    OUT PUT IS 30?" button hit.
    (2)
    In popup step how do I get the "text on the button" in the report rather than button index?
    File attached
    Attachments:
    test_stand.zip ‏32 KB

    The handle to the Step.Button1Label gets you the data, but there are several ways to get it into the actual report.
    The easiest is to use the reporttext.
    In a post expression, you can use something like
    Step.Result.ReportText = Evaluate("Step.Button" + Str(Step.Result.ButtonHit) +"Label")
    and then the default report generation will include it in the report. Otherwise, you need to get the text into the Resultlist by various means (check the user manual, or the TestStand II customisation course) and handle the report generation yourself inside of the appropriate sequence in the process model.
    Just my 2cents
    S.
    // it takes almost no time to rate an answer
    Attachments:
    IncludeButtonTextInReport2_0.seq ‏18 KB

  • WIP QTY. AND VALUE IN SINGLE REPORT FOR A PARTICULAR PERIOD

    Is there any report for a particular period that we can get the WIP qty. and value in single report. If there what the fileds we have to select.
    Ex. We want what is the consumption qty. and value and what is the GR qty. and value for the period ending June 08.

    Hi,
    You can use the T-Code KKAS to get the WIP Qty against a given plant/material combination.
    some of the other supporting t-codes are:
    KKAO                 WIP Calc.: Collective Processing
    KKAQ                 Display WIP - Collective Processing
    KKAT                 WIP Display for Product Cost Coll.
    KKAV                 WIP Calculation for Cost Object Hier
    KKAW                 WIP Display Cost Object Hierarchy
    KKAX                 WIP Calculation for Order
    KKAY                 WIP Display for Order
    Regards,
    JLN

  • After Purchasing Music I'm Getting Duplicates and Can't Remove Them

    I've downloaded 2 albums recently and in both cases they've caused duplicates to be placed on my iPhone 4S.  I do not have this issue on my iPad 2 for some reason.
    The first album I downloaded on to my iPhone using the iTunes app.  All 14 tracks were duplicated.  When I went to change the genre of the songs in iTunes and resync'd, then half of the songs had the original genre and the other half the new genre.  I deleted the Purchased playlist, didn't remove the dups.  I unchecked music syncing in iTunes, deleted all the music EXCEPT the dups.  Finally I just had to erase the whole phone and start new.  Weak.
    The second album I downloaded tonight on my iMac thru iTunes.  When I synced my iPhone and iPad, only on the iPhone did I get duplicates... this time, however, only for tracks 7 thru 16!  Again, I have no way to get rid of them and I don't even see them listed twice when I look at my music list on the iPhone 4S from iTunes on the iMac.
    No, I do not have iCloud or iTunes Match/Connect/whatever.
    Any idea why this is happening and how do I get rid of the duplicates???
    Thanks!
    Curt

    OK, I don't know why it's happening, but I figured out a way to fix things on my iPhone.
    With this last album, even though I made the purchase and download on my iMac in iTunes, for some reason my iPhone 4S showed that I purchased tracks 7-16 and these were the duplicated tracks.  However, the iTunes app showed that I downloaded all the tracks.
    So, regardless, I deleted the album out of iTunes (of course, backing up the folder with the songs in my home directory).  Then I right clicked on my iPhone in iTunes on the iMac and had it transfer purchases.  When this happened, my iTunes on the iMac showed the dups.  Removing them in iTunes on the iMac didn't help.  But, by going to the Artist and then swiping on the offending album from right to left, the option to delete the album on the iPhone appeared.
    Then I re-added the album to my main playlist and synced again.  And now my iPhone has no more dups.  Still, this is obviously a bug with Apple on the iPhone (as I don't have this problem at all on the iPad and both are running iOS 5.0).

  • All of a sudden all of my tracks are squeezed to the left. The Bar Ruler begins at "1" with the next measure at "129" on to the thosands. How do I get back to my original count and un-squeeze my tracks? thank you. John

    All of a sudden all of my tracks are squeezed to the left. The Bar Ruler begins at "1" ith the next measure at "129" on to the thosands. How do I get back to my original count and un-squeeze my tracks? thank you, John at [email protected]

    Welcome to Discussions - the fact that the S.M.A.R.T. status is not recognized and the flashing questions mark appear seem to indicate that your hard drive has failed. If you have access to TechToolPro or Disk Warrior, try to use them to check the drive status. This will likely not work, and I'm afraid your disk is toast.
    You could try to remove the drive and put it in an external case and try to mount it on your MacBook, but I don't hold out much hope for that either. You can try using [Data Rescue|http://www.versiontracker.com/dyn/moreinfo/macosx/211375] to retrieve your data.
    You can also take it in to Apple and see what they say. Please let us know how things turn out,

  • Where or Having clause and COUNT(1)

    I'm having trouble trying to figure out the way to get the conditional difference between two counts in a where clause.
    I would like to scan a table and only select records where the record count of one column attribute is different than another.
    I have
    select name, count(1) from skill <<< TOTAL_COUNT
    and
    select name, count(1) from skill where score is not NULL <<<< SCORED_COUNT
    I want to have a statement that just returns the names for those where TOTAL_COUNT - SCORED_COUNT = 0
    ... meaning those names where any of the rows have not been scored.
    I've tried a "having clause" but it still returns all there names. Even those there TOTAL_COUNT - SCORED_COUNT > 0
    Here's the non-working code....
    select * from
    (select full_name
    from emp e
    where e.manager = 'Smith, John'
    having
    ((select count(1)
    from emp_skill es
    where es.emp_fk = e.id
    group by null) -
    (select count(1)
    from emp_skill es1
    where es1.emp_fk = e.id and
    es1.self_prof is not NULL
    group by null)) = 0
    )

    Don't take 3360 too seriously in this context. COUNT(expression) is a bit of a running joke around these parts.
    However, his response does contain the seed of the solution for your problem.
    COUNT(<expression>) works because the COUNT function counts all rows with a non-null value for expression. So COUNT('Chocula') counts the non-null occurences of the literal string 'Chocula' in the table. Obviously, this counts every row in the table. COUNT(*) counts all the non-null occurences of a row in the table (even a row with all null values is a row). Clearly these are equivalent.
    However, if <expression> evaluates differently for each row, then COUNT(*) and COUNT(<expression>) can differ. So, for your example, assuming that the scored column is truly NULL in some records, what you need is something like:
    SQL> SELECT * FROM skill;
    NAME            SCORE
    BOB                 5
    BOB                 6
    BOB                 7
    BILL                5
    BILL                8
    BILL
    SQL> SELECT name, total, scored
      2  FROM (SELECT name, count(*) total, count(score) scored
      3        FROM skill
      4        GROUP BY name)
      5  WHERE total <> scored;
    NAME            TOTAL     SCORED
    BILL                3          2

  • Can you use iTunes match and not get duplicates if you maintain mp3s and aiffs files of the same song in either the same or separate libraries?

    I maintain a collection of aiff files and mp3 files of the same music.
    Aiff for home listening and Mp3 for my devices.
    I can arrange these in the same or seperate libraires.
    Will "itunes match" duplicate the songs in the cloud if they in the same or seperate libraies on the same mac?
    If not, is anyone aware of how to manage seperate Mp3 and Aiff libraries so as not to get duplicates in itune match?
    All assistance is appreciated.
    Thanks!

    Hello mracole,
    I checked my "purchases" and the 7/19/13 purchases don't show up.  However, the earlier versions from usually several years back...the ones that are Matched...often do show up in my Purchases.  I suspect that somehow those REALLY purchased several year old versions were deleted and redownloaded by me so I could change them to the 256 kbps versions under iTunes Match.  They were probably 128 kbps versions originally when purchased.
    Why the earlier versions that were really purchased are now identified as Matched is puzzling.
    Why I now have Purchased versions from 7/19/13 is puzzling too...especially since these versions do NOT show up in my purchases.
    Calling Apple Support if a good idea unless someone can explain this mystery.  I might even take one of my laptops to the Apple store and show a Genius.
    Thank you very much for taking the time to respond, Mr. Luigi

Maybe you are looking for