473,387 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 1452
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
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.