Thread: update query
View Single Post
  #2  
Old July 5th, 2009, 06:23 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 2,364
Default update query

Is SN unique in your table? Or is it a least unique for any specific date?

It appears that you are matching the smallest value in query A with
smallest value in query B and then the next smallest with the next
smallest, etc. Is that true?

I'm not sure you can do it directly with one update query. You would
probably need to create a temporary table and then use that as the
source for an update.

It would help if you posted the SQL of your two current queries.

And even then this is going to be pretty complex to solve and slow for
any large set of records.

'================================================= ===
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'================================================= ===


fresher wrote:
Dear Team,

I have created 2 queries which contain 2 difference result set, in fact this
2 queries from same table and this table linked from SQL database.

I already lable 1st query as A and 2nd query as B, each query only have 4
column,

as:
A.Column1 (Site A)
A.Cloumn2 (SN)
A.Column3 (Date)
A.Column4 (Value)

B.Column1 (Site B)
B.Column2 (SN)
B.Column3 (Date)
B.Column4 (Value)

I wish to update the B.Column2 = A.Column2, but I have only 1 same creteria
which is date,however the date can be repeated.

Please advise on how to create a scipt / SQL statement to update the result
set, I have to update row by row manually at this moment,

Example of result set:

Query A:
Site SN Date Value
A 001 01/07/2009 1000
A 002 01/07/2009 2000
A 003 01/07/2009 1500
A 004 01/07/2009 3400
A 005 01/07/2009 4500

Query B:
Site SN Date Value
B 021 01/07/2009 4000
B 025 01/07/2009 7000
B 029 01/07/2009 8500
B 030 01/07/2009 4400
B 035 01/07/2009 5500

Expected result set:
Query B:
Site SN Date Value
B 001 01/07/2009 4000
B 002 01/07/2009 7000
B 003 01/07/2009 8500
B 004 01/07/2009 4400
B 005 01/07/2009 5500

Anybody's advise and assistance is much appreciated.

Thanks & regards,
fresher