|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how do i say this...Given the table: DeptName Status IT Updated IT Unchanged IT Unchanged Finance Updated Finance Unchanged How do i answer this question in SQL syntax: What is the total count for each status type? The answer for the above scenario should be : Unchanged 3 Updated 2 thanks, rodchar SELECT Status, COUNT(*)
FROM table_name_not_specified GROUP BY Status Show quote "rodchar" <rodc***@discussions.microsoft.com> wrote in message news:C5F677EC-CD46-402B-ACED-55435B2D7488@microsoft.com... > hey all, > Given the table: > DeptName Status > IT Updated > IT Unchanged > IT Unchanged > Finance Updated > Finance Unchanged > > > How do i answer this question in SQL syntax: > What is the total count for each status type? > > > The answer for the above scenario should be : > Unchanged 3 > Updated 2 > > thanks, > rodchar Thank you.
Show quote "Aaron Bertrand [SQL Server MVP]" wrote: > SELECT Status, COUNT(*) > FROM table_name_not_specified > GROUP BY Status > > > > > "rodchar" <rodc***@discussions.microsoft.com> wrote in message > news:C5F677EC-CD46-402B-ACED-55435B2D7488@microsoft.com... > > hey all, > > Given the table: > > DeptName Status > > IT Updated > > IT Unchanged > > IT Unchanged > > Finance Updated > > Finance Unchanged > > > > > > How do i answer this question in SQL syntax: > > What is the total count for each status type? > > > > > > The answer for the above scenario should be : > > Unchanged 3 > > Updated 2 > > > > thanks, > > rodchar > > > |
|||||||||||||||||||||||