Re: Complicate report: how to sort out single records?
- From: "David Portas" <REMOVE_BEFORE_REPLYING_dportas@xxxxxxx>
- Date: 31 Jan 2006 11:54:09 -0800
David Portas wrote:
>
> Without seeing your data this is just a wild guess. Try:
>
> SELECT roll_no, last_name, first_name, ...
> FROM students AS S
> JOIN attendance AS T
> ON S.roll_no = T.roll_no
> WHERE EXISTS
> (SELECT 1
> FROM attendance AS A
> WHERE A.roll_no = S.roll_no
> AND A.present = 'N' /* student didn't attend */
> HAVING COUNT(*)>1) ;
>
That should work OK for SQL Server but as I've just realized this is an
Access group I don't know how useful it will be to you :-)
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
.
- References:
- Complicate report: how to sort out single records?
- From: Galka
- Re: Complicate report: how to sort out single records?
- From: David Portas
- Complicate report: how to sort out single records?
- Prev by Date: Re: Conditional test to combine multiple records
- Next by Date: Re: Print report multiple times based on value in the report
- Previous by thread: Re: Complicate report: how to sort out single records?
- Next by thread: Edit a Query
- Index(es):
Relevant Pages
|