NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

DataBase elementry question

HI,
I'm trying, for the first time, to use the DB componnents of TS(3.0).

I have successfuly accomplished Open DB to my own DB containing a table CARD_RSLTS.

I have successfuly accomplished openSQL statement as follow: "SELECT CARD_RSLTS.SERIAL, CARD_RSLTS.CARD_CYCLE FROM CARD_RSLTS WHERE CARD_RSLTS.SERIAL='NNTML218TYXK' ORDER BY CARD_RSLTS.CARD_CYCLE"

Now, I would like to perform the following:
Since all the records to this specific Serial number have been ordered by CARD_CYLCE. I would like to read the last record and obtain the value of that CARD_CYCLE.

Could anybody show me how to do it?

Thanks
Rafi
0 Kudos
Message 1 of 2
(2,966 Views)
To Rafi -
Try
"SELECT TOP 1 CARD_RSLTS.SERIAL, CARD_RSLTS.CARD_CYCLE
FROM CARD_RSLTS
WHERE CARD_RSLTS.SERIAL='NNTML218TYXK'
ORDER BY CARD_RSLTS.CARD_CYCLE DEC"

The "TOP 1" returns one row, and the "DEC" returns the list in descending order so the bottom row will be at the top.

Scott Richardson (NI)
Scott Richardson
https://testeract.com
Message 2 of 2
(2,966 Views)