Re: Transact Max Statement

hkvats_1999_at_yahoo.com
Date: 06/25/04


Date: 25 Jun 2004 02:20:07 -0700

HI,

Just run following query.......... hope that you will get desired
results....

SELECT tblTicket.Name, tblTicket.Address, x.tblTicketLog.Entry
FROM tblTicket INNER JOIN (SELECT tblTicketLog.Entry,
tblTicketLog.EntryID FROM tblTicketLog)
ON X.EntryID = tblTicket.EntryID
WHERE X.EntryID = (SELECT Max(tblTicketLog.EntryID) FROM tblTicketLog)

Regards
Hari Sharma
Sr. Constulant... Databases....

sdavenport@sigcom.net (Scott D) wrote in message news:<28cc758f.0406161113.2375ab83@posting.google.com>...
> I am trying to execute a SELECT statement that will have one of the
> parameters only needing to be the last log entry.
>
> Example: (This should help)
>
> I want to do something like this
>
> SELECT tblTicket.Name, tblTicket.Address, (SELECT tblTicketLog.Entry
> WHERE Max(tblTicketLog.EntryID)) FROM tblTicket INNER JOIN
> tblTicketLog ON tblTicketLog.EntryID = tblTicket.EntryID
>
> I know this syntax is incorrect as it throws an error. Basically this
> is a help desk system that needs to show open tickets and their last
> log entry. The table structure is as follows:
>
> tblTicket
> ---------
> TicketNo PK
>
> tblTicketLog
> ------------
> TicketNo FK
> EntryID PK
> Entry
>
> I will be glad to explain further if this makes no sense. Thank you
> in advance for your help.


Loading