Re: Complicate report: how to sort out single records?



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
--

.



Relevant Pages

  • Re: Select command with multiple tables
    ... it becomes difficult to write each and every field in the query. ... David Portas, SQL Server MVP ... State what version of SQL Server you are using and specify the content ... will it be inefficient to use select * from .. ...
    (comp.databases.ms-sqlserver)
  • Re: Select command with multiple tables
    ... is slow because it requires extra work by the server to retrieve the ... David Portas, SQL Server MVP ... State what version of SQL Server you are using and specify the content ... A user needs a few more fields in the database and adds them to a table ...
    (comp.databases.ms-sqlserver)
  • Re: ORDER BY in View and ADP Form
    ... im disagreeing with that David Portas ... WHY DOES EVERY ACCESS MVP DIPSHIT IN THE WORLD NOT UNDERSTAND THE ... try building a cube based off of a sproc lol ... Views have no fixed ordering in SQL Server. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: ORDER BY in View and ADP Form
    ... So you are admitting now that Microsoft is NOT committed to ADP's. ... im disagreeing with that David Portas ... WHY DOES EVERY ACCESS MVP DIPSHIT IN THE WORLD NOT UNDERSTAND THE ... Views have no fixed ordering in SQL Server. ...
    (microsoft.public.access.adp.sqlserver)
  • Re: New bie question about NULL
    ... > key (personId, measureName) ... > Pro SQL Server 2000 Database Design - ... > "Peter" wrote in message ... >>> David Portas ...
    (microsoft.public.sqlserver.programming)