I think you only want to group by w_types.TYPE_ID to get what you want.

Phillip B.

----- Original Message -----
From: "Owens, Howard" <[EMAIL PROTECTED]>


> The following query doesn't quite do what I want it to do, and I'm stumped
> on how to get what I want ...
>
> SELECT  COUNT(a_items.WINE_TYPE_ID) AS WCOUNT,
> w_types.TYPE_ID,
> w_types.TYPE,
> a_items.TYPE_ID,
> a_items.END_TIME
> FROM w_types, a_items
> WHERE w_types.TYPE_ID = a_items.TYPE_ID
> AND DATEDIFF( minute, #createODBCDATETIME(dateAdd("h", "-3", NOW()))#,
> a_items.END_TIME) >= 0
> GROUP BY w_types.TYPE_ID,
> w_types.TYPE,
> a_items.TYPE_ID,
> a_items.END_TIME
> ORDER BY TYPE
>
> What I need is something that returns:
>
> a_typeA (5)
> a_typeB (6)
>
> Where (n) is the number of that named type.
>
> What I'm getting is
>
> a_typeA (1)
> a_typeA (1)
> a_typeA (1)
> a_typeA (1)
> a_typeA (1)a_typeA (1)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

                        

Reply via email to