Unique Values

  • I need to find out the date the first bit of software was installed, the following query

    select distinct(machine),software,date

    from devices

    group by machine,date

    Returns

    MachineA   11/09/00

    MachineA   21/10/02

    MachineB   01/07/03

    MachineB   18/07/02

    What i need is  is one record, so machineA with the earliest software installed, but it is returning all the dates. An example of what I am after is:

    MachineA   11/09/00

    MachineB   18/07/02

    Thanks

     

  • Select Machine, Software, min(date) as FirstInstall

    from dbo.Devices

    group by Machine, Software

  • Thanks, worked a treat

  • HTH.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply