Re: filtering groups




Ok, I'm in need of a little help... I know this is a simple task, but I
need a push since my brain isn't working... I have a database that
allows officers to give tickets to violators... I'm trying to create a
query that joins the violators table (violatorID (primary key), and
OperatorLicenseNumber) and the violations table (violatorID(foreign
key), DateTimeViolation)... I want to be able to return the last record
of a datetimeviolation, and the operatorlicensenumber of that last
violation. How would I go about putting it into code? So far, I've
got:

SELECT a.ViolatorID, OperatorLicenseNumber, DateTimeViolation
FROM Violators AS a INNER JOIN Violations AS b
ON a.ViolatorID = b.ViolatorID

but how do I pull up the last datetimeviolation, along with showing the
violators operatorlicensenumber?


Ugh... I love SQL, but help!



--
zoe1982
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message948760.html

.



Relevant Pages

  • Re: Query to return last record
    ... allows officers to give tickets to violators... ... query that joins the violators table (violatorID (primary key), ... OperatorLicenseNumber) and the violations table (violatorID(foreign ... SELECT a.ViolatorID, OperatorLicenseNumber, DateTimeViolation ...
    (microsoft.public.access.gettingstarted)
  • Re: filtering groups
    ... >allows officers to give tickets to violators... ... >OperatorLicenseNumber) and the violations table (violatorID(foreign ... >of a datetimeviolation, and the operatorlicensenumber of that last ... >FROM Violators AS a INNER JOIN Violations AS b ...
    (microsoft.public.sqlserver.mseq)