473,505 Members | 13,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Select/Update Query

Hello,

I've had help from this group before and I hope someone could be of
help again.

I have 2 tables as follows

tbl_joinings

Mnum JoinDate
1001 01/10/04
1001 02/11/04
tbl_matings

Mnum MateDate JoinDate
1001 31/10/04
I need to generate a query which will
"select the date from tbl_joinings just before the date 31/10/04 in
tbl_matings, i.e. 01/10/04. This to be repeated for 1000 or so records.

The tbl_matings table after this update would be as follows..

tbl_matings

Mnum MateDate JoinDate
1001 31/10/04 01/10/04
Note - There is not a 1 to many relationship between these tables. In
fact it would be a many to many relationship.

Any help would be most appreciated

Thank you...

osmethod

Nov 13 '05 #1
4 1455
maybe I don't understand your question but why not
SELECT j.Mnum, m.MateDate, Max(j.JoinDate) as JoinDate
FROM tbl_joinings as J INNER JOIN tbl_matings as M ON j.Mnum=m.Mnum
WHERE m.MateDate>=j.JoinDate
GROUP BY j.Mnum, m.MateDate

HTH
Pachydermitis

Nov 13 '05 #2
maybe I don't understand your question but why not
SELECT j.Mnum, m.MateDate, Max(j.JoinDate) as JoinDate
FROM tbl_joinings as J INNER JOIN tbl_matings as M ON j.Mnum=m.Mnum
WHERE m.MateDate>=j.JoinDate
GROUP BY j.Mnum, m.MateDate

HTH
Pachydermitis

Nov 13 '05 #3

Pachydermitis wrote:
maybe I don't understand your question but why not
SELECT j.Mnum, m.MateDate, Max(j.JoinDate) as JoinDate
FROM tbl_joinings as J INNER JOIN tbl_matings as M ON j.Mnum=m.Mnum
WHERE m.MateDate>=j.JoinDate
GROUP BY j.Mnum, m.MateDate

HTH
Pachydermitis


Why not indeed....

That worked perfectly "Pachydermitis" - Sincere Thank you..

osmethod

Nov 13 '05 #4

Pachydermitis wrote:
maybe I don't understand your question but why not
SELECT j.Mnum, m.MateDate, Max(j.JoinDate) as JoinDate
FROM tbl_joinings as J INNER JOIN tbl_matings as M ON j.Mnum=m.Mnum
WHERE m.MateDate>=j.JoinDate
GROUP BY j.Mnum, m.MateDate

HTH
Pachydermitis


Why not indeed....

That worked perfectly "Pachydermitis" - Sincere Thank you..

osmethod

Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11105
by: avinash | last post by:
hi myself avi i am developing one appliacaion in which i am using vb 6 as front end, adodb as database library and sql sever 7 as backend. i want to update one table for which i required data from...
17
4971
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
6
9305
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is...
1
2613
by: Greg Strong | last post by:
Hello All, Any reason why a select query that runs will not run as an update query? What I've done is created a select query that runs successfully. The query has several custom functions to...
5
1831
by: cdtsly | last post by:
Hi i have a table with all value at 4 i select all lines in a fetch i update one with a value of 7 i update all the row in the fetch with a value 5 the result is that all my row are at 5 and...
5
8314
by: parwal.sandeep | last post by:
Hello grp! i'm using INNODB tables which are using frequently . if i fire a SELECT query which fetch major part of table it usually take 10-20 seconds to complete. in mean time if any UPDATE...
3
2659
by: eholz1 | last post by:
Hello PHP programmers. I had a brilliant idea on one of my pages that selects some data from my mysql database. I first set the page up to display some info and an image, just one item, with a...
9
4375
by: P3Eddie | last post by:
Hello all! I don't know if this can even be done, but I'm sure you will either help or suggest another avenue to accomplish the same. My problem may be a simple find duplicates / do something...
3
9106
by: RAG2007 | last post by:
I'm using the QueryDef and Execute method to update a record in my MySQL backend. Problem: When the Passthrough update query is defined using QueryDef, it becomes a select query, and I cannot use...
2
1880
by: DuncanIdaho | last post by:
Hi Apologies if this is similar to a (very) recent post. I was wondering if it is possible to execute an update query that contains a select statement on an MS access 2000 database. I have...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.