|
-
Apr 11th, 2000, 04:28 PM
#1
Thread Starter
Fanatic Member
I was wondering If some one can help me out.
I have two tables that I need to retrive data from both have the same primary key (1 to many). I need to display all the information from the first table and how many fields that match in the second table. I've been playing around with the count Funtion and using an inner query but cannot get it to do what I need. Bellow is roughly the way I need it. Thanks in advance for any help.
SELECT primarykey,field1,field2, count(all the fields in table2 that has the primarykey of table1) FROM table1
-
Apr 11th, 2000, 09:55 PM
#2
Frenzied Member
This should work
try:
select a.primarykey, a.field1, a.field2, count(b.primarykey) as "Record counts"
from table1 a, table2 b
where a.primarykey=b.primarykey
group by a.primarykey, a.field1, a.field2
-
Apr 11th, 2000, 10:20 PM
#3
Thread Starter
Fanatic Member
Thanks Jhausman That was just the ticket.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|