Wednesday, March 28, 2012

Query problems

I am running a the following query:

SELECT [LICENSE_STATE], [LICENSE_PLATE], [TICKET_NUMBER], [DATE_ISSUED], [TIME_ISSUED], [MAKE_TYPE]
FROM dmv;

When I run the query I get multiple violations on an individual license plate. I only want it to display the license plate once even if it has multiple violations. I thought I could use a distinct statement to filter out the multiple plate entries but it either filters the plates and does not show any of the other information or it doesn't filter the results at all.

Here is the distict satement I am using that filters out everything except for the plates.

SELECT DISTINCT dmv.LICENSE_PLATE
FROM
(
SELECT [LICENSE_STATE], [LICENSE_PLATE], [TICKET_NUMBER], [DATE_ISSUED], [TIME_ISSUED], [MAKE_TYPE]
FROM dmv
);

Any help would be appreciated.Never Mind I figured it out

No comments:

Post a Comment