libertyct Posted November 19, 2007 Share Posted November 19, 2007 i cant seem to get the select LAST function to work from mysql, i was just experimenting and thought this was a cool function, can anybody confirm if this is supported in mysql 5? SELECT LAST(column) AS [expression] MYSQL thnx! Quote Link to comment Share on other sites More sharing options...
fenway Posted November 19, 2007 Share Posted November 19, 2007 LAST? What is that supposed to do? Quote Link to comment Share on other sites More sharing options...
libertyct Posted November 19, 2007 Author Share Posted November 19, 2007 if you have a clomun of unix dates eg 100000001 100000002 100000003 it will return 100000003.. i guess its similar to MAX() what would be the best way to find a users last transaction from a table using the unix date? table is simple, looks something like this TRANSACTION ID | STUDENTD ID | TRANSACTION DATE | TRANSACTION TYPE now a student might have several different transactions but i only want to retrieve thier most recent transaction, i tried it using the MAX() function but it only returns the last transaction date and not the complete last transaction row my query looks something like this SELECT trans.fldStudentID, prsn.fldFirstName, prsn.fldLastName, MAX(trans.fldDate) AS fldTransactionDate, trans.fldTransactionCode, trans.fldCohortID FROM tblTransaction trans LEFT JOIN tblStudent stdn ON (trans.fldStudentID = stdn.fldStudentID) LEFT JOIN tblPerson prsn ON (stdn.fldStudentPersonID = prsn.fldPersonID) WHERE trans.fldCohortID = 1 GROUP BY trans.fldStudentID ORDER BY prsn.fldLastName ASC thnx! Quote Link to comment Share on other sites More sharing options...
fenway Posted November 19, 2007 Share Posted November 19, 2007 Don't the transactions have a date? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.