Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to get last value from my btblInvoiceLineSN table.
these are the two queries i tried but the are mot working.


select last(cSerialNumber)from _btblInvoiceLineSN

select cSerialNumber from _btblInvoiceLineSN order by idInvoiceLineSN Limit 1

how to get last value of any tables particular column.
Posted

SELECT TOP 1 cSerialNumber FROM _btblInvoiceLineSN ORDER BY cSerialNumber desc
 
Share this answer
 
can u show your table structure ?
 
Share this answer
 
Comments
ByakuyaKuchiki 5-Mar-13 2:10am    
idInvoiceLineSN iSerialInvoiceID iSerialInvoiceLineID cSerialNumber
1 19 18 RET001
2 19 18 RET002
3 19 18 RET003
4 19 18 RET004
5 19 18 RET005
6 19 18 RET006
7 19 18 RET007

i want to get lat value of cSerialNumber which will be RET007
gvprabu 5-Mar-13 2:43am    
SELECT TOP 1 cSerialNumber FROM YourTableName ORDER BY idInvoiceLineSN DESC
select * from _btblInvoiceLineSN where
idInvoiceLineSN= (select MAX(idInvoiceLineSN) from _btblInvoiceLineSN)
 
Share this answer
 
select top1 from tablename order by idInvoiceLineSN DESC
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900