12-13-2005 11:37 AM
12-13-2005 11:59 AM
The SQL query for something like this is:
SELECT MAX(column2) FROM tablename
12-14-2005 04:39 AM
12-14-2005 04:55 AM
Hi
In your picture it all is wired correctly, you just have to pass the correct "Where"-clause. I'm not sure, but I think you can't use "Max" in a where clause.
So I'd suggest you to make two selection. The firs (Select Max(col1) From table) to get the maximum value and a second to get the data. There you can use the vi which is in your picture and wire a where-clause (WHERE col1=[result from 1st select]).
Hope this helps.
Thomas
12-14-2005 05:03 AM
12-14-2005 05:48 AM
12-14-2005 06:59 AM
Hi!
I have a problem.......the column i have to find the maximum value is a colum of time 10:21:13 and i don't know why the maximum value the vi import from the database is today's data 14/12/05 (?*¿*). I don't know why. I'm tried to find the maximum of a number's column and it works perfect.
Another thing about this i want to ask you is to use an event structure to only run this subvi when a new row is written, how can i do this? CAn i know the number of rows written without importing all the data of the table?
Thank you very much Becktho
Larson
12-14-2005 07:10 AM
I can't tell you why it doesn't work or how you could make it work using time. I always have an Index column in each table of an auto-incrementing type. So to use this is very easy as you already said - numbers work without problem.
Using an event-structure I just can say yes and no. Do you write the data on your own or is it written by another program? How is your program structured?
To read the number of rows you can use this statement: "SELECT Count(data.col1) AS numRows FROM data". This will give you one value - the number of rows in your table.
12-14-2005 12:57 PM
12-15-2005 01:01 AM
Hi Larson
To select row n you either need a certain value (e.g. an index or something you know is unique in row n) or you select all values and extract one row in LV.
So the first statement would be "SELECT * (* means all columns, you could also specify the columns as well) FROM data WHERE [a value = another value]. This would give you just the rows where the where-clause is correct. The other way is to select all data and just extract row n from the array you get from the recordset.
There might be other ways, but these are two solutions I just had in mind.
Manuals - just google the internet for SQL (Structured Query Language) and you will find lots of websites providing this information.
Hope this helps.
Thomas