01-05-2004 03:45 PM
01-06-2004 11:08 AM
03-08-2006 09:35 AM
Hello,
I am trying to sort data and I am having the same question as Shiva.
My vi shows no error but it brings back no data.
Here's the vi.
03-08-2006 10:16 AM
Hello,
I am able to get data,but now the issue is that each of my individual indicators do not reflect the field name when I am querying with sql statements.
This the error I am getting:
"Rec Get Value From Field.vi->Rec Fetch Binary Data (R).vi->EX3.vi<ERR>Exception occured in ADODB.Fields, Item cannot be found in the collection corresponding to the requested name or ordinal.. Help Path is C:\WINDOWS\HELP\ADO270.CHM and context 1240649 in Rec Get Value From Field.vi->Rec Fetch Binary Data (R).vi->EX3.vi"
Any Suggestions??
VI attached.
03-10-2006 12:24 AM
So to clarify, you ARE getting some data back from your query, but not the data you expect to see? I've tried searching for that error, but I haven't come up with anything. The error message makes it sound like you are searching for something that doesn't exist in the database. Have you taken a look at the help file that it points to in the error message? That may give us more information about what the error message means.
-Justin
03-10-2006 09:01 AM
07-08-2015 04:03 AM
Hi. I am having the same problem. Using the "Select Data" vi from within the Connectivity Toolkit, addressing a microsoft access database. I am searching on the column labeled "ID".
The statment "WHERE ID = 4" will work perfectly fine, but the statment "WHERE MAX(ID)" returns nothing. Can you tell me how you fixed the problem please, I am stumped!
Many thanks, Alec
12-17-2019 02:17 AM
Having the same issue here.
Where ID='3' for example works fine but
Where ID=MAX(ID) does not work.
Did you get any further?
Neil
12-18-2019 08:52 AM - edited 12-18-2019 08:55 AM
@NToombes wrote:
Having the same issue here.
Where ID='3' for example works fine but
Where ID=MAX(ID) does not work.
Did you get any further?
Neil
That is a SQL-problem, not LabVIEW.
max(id) is an aggregate function on id and can not be used in a where clause. If you need to filter on aggregate functions you need to use group by and having.
https://docs.data.world/documentation/sql/concepts/intermediate/HAVING.html
But you will not be able to do what you want since group by / having will not accept the clause "id = max(id)".
I do not know what you really want to accomplish, it may be possible to use offset/fetch:
select * from <table> order by id desc fetch first 1 row only;
I think this is standard SQL. It works in PostgreSQL, but may not work on your database / database server.
The query selects all elements in table, sort them descending on the id-column and returns the first row of the result.
12-18-2019 09:08 AM - edited 12-18-2019 09:10 AM
Hi RolfO
Thanks for your reply / message. I actually came up with another workaround which might not be as nice but it does work.
So, used the max(id) to just retrieve the maximum value (last entry as its an auto incrementing value) and then used the returned value in the where statement to retrieve the whole row of data associated to that max ID value. I have attached an example image of the code incase it helps others but don't want others thinking I am teaching them to suck eggs 🙂
Neil