PDA

View Full Version : Big query-Problem! Please help...


gondor
09-03-2004, 03:03 PM
hi!

i have a problem with a update-query:

start-structur (1 index, 2 datetime, 3 time of measurement, 4-6 values):

1 | 0000-00-00 00:00:00 | 0 | 21 | 22 | 23
2 | 0000-00-00 00:00:00 | 1 | 21 | 22 | 23
3 | 0000-00-00 00:00:00 | 3 | 21 | 22 | 23
4 | 0000-00-00 00:00:00 | 5 | 21 | 22 | 23
5 | 0000-00-00 00:00:00 | 3 | 21 | 22 | 23 <-- zero crossover
6 | 0000-00-00 00:00:00 | 5 | 21 | 22 | 23
7 | 0000-00-00 00:00:00 | 7 | 21 | 22 | 23

which update-query is useful to add the measurementtime on the datetime?

(startdate: 2004-05-01 14:04:56)

should be:

1 | 2004-05-01 14:04:56 | 0 | 21 | 22 | 23
2 | 2004-05-01 14:04:57 | 1 | 21 | 22 | 23
3 | 2004-05-01 14:05:00 | 3 | 21 | 22 | 23
4 | 2004-05-01 14:05:05 | 5 | 21 | 22 | 23
5 | 2004-05-01 14:05:08 | 3 | 21 | 22 | 23 <-- be careful...
6 | 2004-05-01 14:05:13 | 5 | 21 | 22 | 23
7 | 2004-05-01 14:05:20 | 7 | 21 | 22 | 23

sorry for my 'poor' english... i´m german.

thanks.

raf
09-03-2004, 04:39 PM
I don't realy get your problem.

With my psychic powers fully boosted, i think your asking how you can make a distinction between record 3 and record 5, so that only record 5 is updated? Right?

well, then you need to include the index in your updates where-clause. like

update table set timeofmeasurement = Now() where indexcolumn=5


Or isn't that your problem?

gondor
09-03-2004, 04:53 PM
hey raf!

... not really. but first: thanks for answer... ;)

every row must be updated. the starttime ist not the current date (now())

here another description of my problem:

datetime = last_insert_datetime + time of measurement;

example for row 5:

4 | 2004-05-01 14:05:05 | 5 | 21 | 22 | 23 <- zero crossover!!!

next row:

2004-05-01 14:05:08 = 2004-05-01 14:05:05 + 3;

5 | 2004-05-01 14:05:08 | 3 | 21 | 22 | 23

but which query is necessary to built the right table-structur?

please help...

gondor(..)