Gossamer Forum
Home : General : Databases and SQL :

distinct list of items

Quote Reply
distinct list of items
I am trying to show a distinct list of item numbers, with the following sql statement in MS Query, but it gives me an error when I try to add DISTINCT to "count (DISTINCT(RequestTable.Itemno))" in the SELECT statement. Is this a MS Query problem or is there another way I should be doing this? I've tried the syntax different ways, but nothing seems to work. Thanks.

SELECT PlantnoTable.`Plant name`, DwgClassTable.type, Count(RequestTable.Itemno)
FROM Drawingtable Drawingtable, DwgClassTable DwgClassTable, PlantnoTable PlantnoTable, RequestTable RequestTable, SchMilestonetable SchMilestonetable
WHERE Drawingtable.PlantNo = PlantnoTable.PlantNo AND Drawingtable.DWGClass = DwgClassTable.DrawingClass AND Drawingtable.Itemno = SchMilestonetable.ItemNo AND RequestTable.Itemno = Drawingtable.Itemno AND ((SchMilestonetable.Actualdate Between {ts '2002-01-01 00:00:00'} And {ts '2002-12-31 00:00:00'}) AND (SchMilestonetable.EventCatagory='RES Appr'))
GROUP BY PlantnoTable.`Plant name`, DwgClassTable.type
Quote Reply
Re: [lisads17] distinct list of items In reply to
What does the error say?

Cheers,

Alex
--
Gossamer Threads Inc.