list records

G

geebee

i have 3 tables.

table1. contains idnumbers and other information
table2. contains issues related to the idnumbers in table1
table3. contains information regarding to companies

i want to display the idnumbers along with issues from table2 for each
idnumber.
but only the issues should be listed which have an issueID = min(issueID)
from table1 for each idnumber. the other conditions are that the noticedate
from table2 should be >= to the noticedate from table1 for each record.

thanks in advance,
geebee
 
M

Michel Walsh

SELECT idnumber, MIN(issueID)
FROM table2
GROUP BY idNumber


saved as idWithMinIssue, then:




SELECT *
FROM ( table1 INNER JOIN idWithMinIssue
ON table1.idnumber = idWithMinIssue.idNumber)

INNER JOIN table2
ON table2.idnumber = idWithMinIssue.idNumber
AND table2.noticedate >=table1.noticedate





Vanderghast, Access MVP
 
K

KARL DEWEY

Your post is jumbled!

You say table1 contains idnumbers but none of the other have idnumber.

How are the table2 issues related to the table1 idnumbers?

How can there be a relationship like 'an issueID = min(issueID) from table1'?

Then you say ' the noticedate from table2 should be >= to the noticedate
from table1 for each record.' but you never listed [noticedate] as a field in
the tables. Do both tables have [noticedate]?

Post the actual table structure with field names to include datatype and
some sample data from each table.
 
G

geebee

hi,

table1 and table2 both have idnumber and issueID fields. and they are
linked together by idnumber.



KARL DEWEY said:
Your post is jumbled!

You say table1 contains idnumbers but none of the other have idnumber.

How are the table2 issues related to the table1 idnumbers?

How can there be a relationship like 'an issueID = min(issueID) from table1'?

Then you say ' the noticedate from table2 should be >= to the noticedate
from table1 for each record.' but you never listed [noticedate] as a field in
the tables. Do both tables have [noticedate]?

Post the actual table structure with field names to include datatype and
some sample data from each table.

geebee said:
i have 3 tables.

table1. contains idnumbers and other information
table2. contains issues related to the idnumbers in table1
table3. contains information regarding to companies

i want to display the idnumbers along with issues from table2 for each
idnumber.
but only the issues should be listed which have an issueID = min(issueID)
from table1 for each idnumber. the other conditions are that the noticedate
from table2 should be >= to the noticedate from table1 for each record.

thanks in advance,
geebee
 
K

KARL DEWEY

Read the rest of the post.

geebee said:
hi,

table1 and table2 both have idnumber and issueID fields. and they are
linked together by idnumber.



KARL DEWEY said:
Your post is jumbled!

You say table1 contains idnumbers but none of the other have idnumber.

How are the table2 issues related to the table1 idnumbers?

How can there be a relationship like 'an issueID = min(issueID) from table1'?

Then you say ' the noticedate from table2 should be >= to the noticedate
from table1 for each record.' but you never listed [noticedate] as a field in
the tables. Do both tables have [noticedate]?

Post the actual table structure with field names to include datatype and
some sample data from each table.

geebee said:
i have 3 tables.

table1. contains idnumbers and other information
table2. contains issues related to the idnumbers in table1
table3. contains information regarding to companies

i want to display the idnumbers along with issues from table2 for each
idnumber.
but only the issues should be listed which have an issueID = min(issueID)
from table1 for each idnumber. the other conditions are that the noticedate
from table2 should be >= to the noticedate from table1 for each record.

thanks in advance,
geebee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top