View Full Version : Update with a twist


naughtyme
07-18-2001, 01:16 AM
This query has me all confused. I have been trying to run the query from a module so that I can move through a record set.

I have two tables of data. In Table1 the data is in 10m blocks and is identified by a Section_uid,Start_metres,End_metres,cracking

Table2 has the same column headings (except the cracking column), but is in 100m blocks.

I want to update the cracking_100m column in Table2 with the sum of cracking from Table1 between each of the 100m blocks.

An example follows minus the vb code

Update cracking_100m as a inner join cracking as b on (a.section_uid=b.section_uid)
SET a.cracking_total=sum(b.cracking)
where b.start_metres between a.start_metres and a.end_metres

Any help would be more than appreciated...I'll do a massage if it helps!

[This message has been edited by naughtyme (edited 07-18-2001).]

Rich
07-18-2001, 04:54 AM
Well it'll be a shame not to get a massage (or was it a misprint)but the general concensus is not to store calculated values in a table, use a query or put the calculation on a form.
HTH

naughtyme
07-18-2001, 04:58 AM
The massage was not a misprint...but as I'm a heterosexual male...no funny stuff ok!?

Thanks for your help Rich. It wasn't long after posting the message that I wrote a simplish query to do the job.

Thanks for replying anyway!

Rich
07-18-2001, 02:06 PM
I just knew it was going to be a message http://www.access-programmers.co.uk/ubb/frown.gif



[This message has been edited by Rich (edited 07-18-2001).]

Fornatian
07-19-2001, 08:34 AM
Humour as well as expertise - v.funny Rich.

naughtyme
07-19-2001, 09:15 AM
You guys!