This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi, How do I retrieve the MAX value of a sql column using LightSpeed (Version : 2.2.948.10429)? E.g: I need the MAX of "Invoice No" from Sales table Regards, Vikas
|
|
|
I could try creating a Query object, sort it by descending order and get the first record. Want to know if there is a better way to accomplish this. --Vikas
|
|
|
You can do this using LINQ: var query = from s in unitOfWork.Sales If you want the whole Sales entity then you would need to do a query with sorting, but you can use paging to bring back only the top record: var query = from s in unitOfWork.Sales The ordering and "first" will be performed in the database so there is no loss of efficiency here. |
|