Combine SQL results which have same value

Home Forums Other Microsoft Servers and SaaS SQL Server 2005 / 2008 / 2008 R2 / 2012 / 2016 Combine SQL results which have same value

This topic contains 1 reply, has 2 voices, and was last updated by  Dext 1 year, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts

  • 5habbaranks
    Member
    #166948

    Hi,
    I’m trying to create a query to query year values, which works. The only problem is I only want to return or combine all similar year values as one rather than related to their actual records. For example multiple records contain the year 2014 so I want the result only to show one value of 2014.

    If I group and order by I still get multiple 2014 values in the results

    SELECT substring(Path,12,4)

    FROM [DB].[dbo].[Projects]

    Where [Path] like ‘XXX%’

    AND [Deleted] = ‘0’

    Group By Path

    Order by Path


    Dext
    Member
    #379110

    Sorry guys – me jumping the gun again. Select distinct works a treat :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.