Re: Checking number of records

From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 08/02/04


Date: Mon, 2 Aug 2004 12:35:01 -0400

SELECT TableA.RecordID, TableA.Name
FROM TableA
JOIN TableB ON TableB.RecordID = TableA.RecordID
GROUP BY TableA.RecordID, TableA.Name
HAVING COUNT(*) < 4

"youngeagle" <eagletender2001@yahoo.com> wrote in message
news:%23Dlsu4KeEHA.3840@TK2MSFTNGP10.phx.gbl...
> How can I write a query that would give me a record number of every record
> that does not have x amount of entries. For instance, I have a table that
> needs to have 4 entries for every record that exists in another table.
>
> Table A: Table B
> RecordID 1 Name: abc RecordID 1 Stuff xyz
> RecordID 1 Stuff efg
> RecordID 1 Stuff rty
> RecordID 1 Stuff qwe
>
> I want to find all records that do not have 4 records in Table B
>
>



Relevant Pages

  • Re: Need help in Query -
    ... Try this query: ... LEFT JOIN TableB b ... This will locate rows in TableA without a counterpart in TableB. ...
    (microsoft.public.sqlserver.mseq)
  • Re: Append Query SQL
    ... > FROM tablea LEFT JOIN tableb ... >In fact, the SELECT portion (the query, without the first line) should ... >return the records in tablea not in tableb, ...
    (microsoft.public.access.queries)
  • Re: sql minus
    ... A "Frustrated Outer Join" query: ... FROM TableA LEFT JOIN TableB ...
    (microsoft.public.access.queries)
  • Re: Does Access support MINUS in query?
    ... Try using the unmatch query wizard to build the query. ... FROM TableA as A Left Join TableB as B ...
    (microsoft.public.access.queries)
  • Re: general question about how best to cache expensive query results
    ... feeds and sometimes don't include the field ... That was my first attempt to limit the entries ... would be the result of that original query. ... presenting the underlying problem and the business requirements. ...
    (comp.databases)