Troy Karjala-Mauz wrote:
> Alle,
>
> I'm having problems figuring how I should write the query(ies), or the CF
> code to accomplish a >= count list. For example:
>
> Table1:
> T1-ID
> T1-Data
>
> Table2:
> T2-ID
> T1-ID
> T2-Data
>
> For each Table1 entry, I can have one or more Table2 entries.
>
> What I need to do is create a list of those Table1 entries that have a >= X
> number of Table2 entries (where X is variable). I don't need Table2's data,
> just Table1's.
That would be something like this:
select table1.id, table1.data, Count(table2.ID)
from table1, table2
where table1.ID = table2.Fkey
group by table1.id, table1.data
having Count(table2.id) >= #X#
Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists