![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I am having trouble trying to figure out how to build two queries: One that lists only clientids that exist in the reservation table just once. And a query that lists clientids in the reservation table that exist more than once. Any ideas? Thanks, -paulw |
#3
| |||
| |||
|
|
Hi, I am having trouble trying to figure out how to build two queries: One that lists only clientids that exist in the reservation table just once. And a query that lists clientids in the reservation table that exist more than once. Any ideas? Thanks, -paulw |
#4
| |||
| |||
|
|
SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))=1)); SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))>1)); |
#5
| |||
| |||
|
|
On Thu, 1 Sep 2011 17:13:31 -0400, "Arvin Meyer" arvinm (AT) invalid (DOT) org> wrote: SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))=1)); SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))>1)); Thank you both! I totally forgot about the HAVING clause and also count. |
#6
| |||
| |||
|
|
PW <emailaddyinsig (AT) ifIremember (DOT) com> wrote in news:f13067l2tamb6hh01m6s1fd2ku1fpf21hd (AT) 4ax (DOT) com: On Thu, 1 Sep 2011 17:13:31 -0400, "Arvin Meyer" arvinm (AT) invalid (DOT) org> wrote: SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))=1)); SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))>1)); Thank you both! I totally forgot about the HAVING clause and also count. If you'd write your queries in the Access query designer, it will use HAVING any time you put criteria under an aggregated field (unless you specifically choose WHERE from the dropdown list). I am really convinced that most people don't use the QBE enough -- it makes many, many things MUCH easier... |
#7
| |||
| |||
|
|
On Sat, 3 Sep 2011 20:35:20 +0000 (UTC), "David-W-Fenton" NoEmail (AT) SeeSignature (DOT) invalid> wrote: PW <emailaddyinsig (AT) ifIremember (DOT) com> wrote in news:f13067l2tamb6hh01m6s1fd2ku1fpf21hd (AT) 4ax (DOT) com: On Thu, 1 Sep 2011 17:13:31 -0400, "Arvin Meyer" arvinm (AT) invalid (DOT) org> wrote: SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))=1)); SELECT * FROM tblReservation GROUP BY ClientID HAVING (((Count(ClientID))>1)); Thank you both! I totally forgot about the HAVING clause and also count. If you'd write your queries in the Access query designer, it will use HAVING any time you put criteria under an aggregated field (unless you specifically choose WHERE from the dropdown list). I am really convinced that most people don't use the QBE enough -- it makes many, many things MUCH easier... David. I guess I am old fashioned but I do realize the power of the MS Access query designer. My wife is very good at it but I keep trying to do things in code I suppose. At least when I can't figure it out! |
![]() |
| Thread Tools | |
| Display Modes | |
| |