473,224 Members | 1,412 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,224 software developers and data experts.

Getting Count(*) From Left side of Join using WHERE on right side of join

Hi,

I have 2 tables: tblStatements and tblLines (one to many) Any
tblStatements record can have many associated records in tblLines.
The search criteria is against tblLines (ie tblLines.fldDateofService
>= '6/1/06' and tblLinesfldDateofService < '7/1/06'.) I join by tblStatements.fldStatementPK and
tblLInes.fldStatmentID (one to many)

I need to return a recordset that will look like (after i pass the
date range)

Total Statements Total Lines
136 1,123
24 869

the problem i get when i join the two tables is that i get this:

Total Statements Total Lines
1,123 1,123
869 869

any help or direction would be greatly appreciated.

Jul 3 '06 #1
2 1419
I think that COUNT(distinct tblStatements.fldStatementPK) will do what
you want. This assumes a single-column PK for the Statements table.

Roy Harvey
Beacon Falls, CT

On 3 Jul 2006 05:17:43 -0700, pa********@gmail.com wrote:
>Hi,

I have 2 tables: tblStatements and tblLines (one to many) Any
tblStatements record can have many associated records in tblLines.
The search criteria is against tblLines (ie tblLines.fldDateofService
>>= '6/1/06' and tblLinesfldDateofService < '7/1/06'.) I join by tblStatements.fldStatementPK and
tblLInes.fldStatmentID (one to many)

I need to return a recordset that will look like (after i pass the
date range)

Total Statements Total Lines
136 1,123
24 869

the problem i get when i join the two tables is that i get this:

Total Statements Total Lines
1,123 1,123
869 869

any help or direction would be greatly appreciated.
Jul 3 '06 #2
Roy,

Thank you so much. That worked perfectly!

thanks,
Paul

Jul 3 '06 #3

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

Similar topics

1
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
0
by: Brent | last post by:
In the usual case, this SQL select count(*) from mytable where ... returns an accurate count of the rows you want. But how do I go about counting rows from this SQL (the sum...if statements...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.