SQL where clause to work with Group by clause after performing a count()
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-06-08T19:12:17Z
Indexed on
2010/06/08
19:32 UTC
Read the original article
Hit count: 348
Tried my usual references at w3schools and google. No luck
I'm trying to produce the following results. QTY is a derived column
| Position | QTY
--------------------
1 Clerk 2
2 Mgr 2
Here's what I'm not having luck with:
SELECT Position, Count(position) AS 'QTY'
FROM tblemployee
Where ('QTY' != 1)
GROUP BY Position
I know that my Position is set up as varchar(255) Count produces a integer data and my where clasue is accurate so that leads me to believe that that Count() is jamming me up. Please throw up an example so I can reference later. Thanks for the help!
© Stack Overflow or respective owner