Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SELECT DISTINCT Help

SELECT DISTINCT Help

Scheduled Pinned Locked Moved Database
databasehelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    solutionsville
    wrote on last edited by
    #1

    I have an SQL 2005 data table that has these coloumn; Name Type EventDate, DateTime WaysideAddress, Nvarchar(50) WaysideName, Nvarchar(50) State, nchar(10) AlarmMessage, Nvarchar(50) What I am trying to do is count the total number of distinct AlarmMessage that each WaysideName reported from the table Grouped by EventDate and WaysideName. The AlarmMessage is all text. So the results of the query should look like this; WaysideName|AlarmMessage|Count Thanks,

    S 1 Reply Last reply
    0
    • S solutionsville

      I have an SQL 2005 data table that has these coloumn; Name Type EventDate, DateTime WaysideAddress, Nvarchar(50) WaysideName, Nvarchar(50) State, nchar(10) AlarmMessage, Nvarchar(50) What I am trying to do is count the total number of distinct AlarmMessage that each WaysideName reported from the table Grouped by EventDate and WaysideName. The AlarmMessage is all text. So the results of the query should look like this; WaysideName|AlarmMessage|Count Thanks,

      S Offline
      S Offline
      solutionsville
      wrote on last edited by
      #2

      Solved my own question; SELECT DISTINCT WaysideName, ST, AlarmMessage, COUNT(AlarmMessage) AS Error_Count FROM AlarmsList GROUP BY WaysideName, ST, AlarmMessage ORDER BY Error_Count DESC, ST, WaysideName, AlarmMessage Thanks Everyone regardless!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups