jeudi 30 juin 2016

update sql table current row


Complete noob alert! I need to store a largish set of data fields (480) for each of many devices i am measuring. Each field is a Decimal(8,5). First, is this an unreasonably large table? I have no experience really, so if it is unmanageable, I might start thinking of an alternative storage method.

Right now, I am creating a new row using INSERT, then trying to put the 480 data values in to the new row using UPDATE (in a loop). Currently each UPDATE is overwriting the entire column. How do I specify only to modify the last row? For example, with a table ("magnitude") having columns "id", "field1", "field2",...:

sql UPDATE magnitude SET field1 = 3.14; this modifies the entire "field1" column.

Was trying to do something like: sql UPDATE magnitude SET field1 = 3.14 WHERE id = MAX(id)

Obviously I am a complete noob. Just trying to get this one thing working and move on... Did look around a lot but can't find a solution. Any help appreciated.


Aucun commentaire:

Enregistrer un commentaire