LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SQL data fetch

Hello.I am currently trying to make a VI which fetches the latest data inserted in table for example I want to get the data from column 3 with the latest inserted ID,for example 27546.In the next iteration of the VI I want to get data from the same column, but the ID is not 27547.I tried using the Execute SQL query but I need the data which was fetched to be considered a double or a string.

 

This is the current SQL query which I am using "SELECT tensiune FROM scada_c2.tensiuni_intrare where id = (select max(id) from scada_c2.tensiuni_intrare)". In my SQL it retrieves the data that I need but I don't know how to use only the element which is fetched.

0 Kudos
Message 1 of 4
(2,288 Views)

@Lopimank wrote:

In my SQL it retrieves the data that I need but I don't know how to use only the element which is fetched.


You've lost me there.

 

Post the (part of the) code (inc. sensible input values and results), and mark the problematic part...

0 Kudos
Message 2 of 4
(2,257 Views)

add "top 1" to only get 1 row and add "sort by id desc" in the end to get the highest ID.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 4
(2,252 Views)

I've been able to modify the DB Execute Statement + Fetch data with the help of one of my friends.

Here's the example he sent me.This is what I needed to do cause I need to append the strings to one other,maybe I didn't explain it well enough when I posted the problem and I am sorry.

 

0 Kudos
Message 4 of 4
(2,231 Views)