12-13-2005 06:10 AM
12-13-2005 07:20 AM
Hi Larson,
Just a quickie as I need to get to work. I think that using SELECT * FROM my_Table; usually returns the data in order that it was written into the table. If that is true you would then you would go to the last row in you array of returned table data.
This would get slower as your table grows
.
Another way of doing it would be to add a field to your table that autoincrements every time you write a record (could be a timestamp too). You would then create a SQL command to get the MAX value of that field then use that value in a select query to return the last row.
David
12-13-2005 11:21 AM
Hi David,
I'd thought your first purpose but i think is not a good solution because each five seconds i have to import the wholwe table and this is not efficient I think.
I think that there is some block that allows you to import the last row but i don't know what.
I'll start working with your second purpose, i think it could be a good way. I can use optional clause from select data block to import the max value from time stamp column (i have yet this column in database).
What you want to say create a SQL command, how do you do this?
Thank you very much David!
Larson
12-14-2005 02:45 AM
Hi Larson
I total agree that my first suggestion isn't what you want but I wanted to put the idea across that you can retrieve records from table in the order they were written using a simple SQL command.
When dealing with databases I always design my queries using Design View in MS Access. Once you have the query designed you can then convert the query you have just designed in Design View to SQL by changing to SQL View.
So this example SQL statement would return the MAX Timestamp.
SELECT Max(tblTimeStampTest.Timestamp) AS MaxOfTimestamp
FROM tblTimeStampTest;
Say the timestamp was 12/14/2005 8:18:33
SELECT tblTimeStampTest.*
FROM tblTimeStampTest
WHERE (((tblTimeStampTest.Timestamp)=#12/14/2005 8:18:33#));
This will return your last record as long at the timestamps are unique and records are written in timestamp order. You can then use Build Text Express VI or Format into String to build your SQL strings that have variables like the timestamp above.
I have no experience with mySQL but I would assume MS Access could interface to it somehow either through ODBC or MS Access Projects so that can build you SQL commands.
David