You are here: Select Unique Distinct records for Column « MsSQL Server « IT news, forums, messages
Select Unique Distinct records for Column

Posted by philip260 on 11/07/06 21:19

Im trying to run a query that will pull distinct data not for the
entire select query but for a single column. Here is my sql statement
below. Why is it not working? It is probably something stupid. Thanks
for your help in advance

SELECT Count(MastrQualityTbl.[WORK NUMBER]) AS [TOTAL WORK RECEIVED],
MastrQualityTbl.USERID, MastrQualityTbl.FIRSTNAME,
MastrQualityTbl.LASTNAME, MastrQualityTbl.TEAM_NAME
FROM MastrQualityTbl as c1
WHERE NOT EXISTS (SELECT MastrQualityTbl.[WORK NUMBER] from
MastrQualityTbl WHERE MastrQualityTbl.[WORK NUMBER] = c1.WORK NUMBER)
and
WHERE (((MastrQualityTbl.DATE) Between
[Forms]![DashBoardForm]![FromDate] And
[Forms]![DashBoardForm]![ToDate]) AND ((MastrQualityTbl.CATEGORY) In
('NEW BUSINESS')))
GROUP BY MastrQualityTbl.USERID, MastrQualityTbl.FIRSTNAME,
MastrQualityTbl.LASTNAME, MastrQualityTbl.TEAM_NAME;

Im trying to count only the unique WORK NUMBERS in this select
statement.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация