>How do I create an SQL statement that has a count of all records, plus a conditional count of the number that meet a specific criteria?
>
>This gives me the count(*) value twice.
>
>SELECT OrderID, COUNT(*), COUNT(Lineitems.Quantity > 500)
FROM Orders INNER JOIN Lineitems on Lineitems.orderid = Orders.orderid
GROUP BY 1
>
>
>Once that works, will using a view parameter(?vp_bonusamount) work instead of the fixed numeric amount?
>
>Chris.
I may have misunderstood what you are counting, but here is a pair of queries that returns one value, using a parameter:
m.bonus = whatever
SELECT OrderID, Count(*) AS counted FROM Lineitems INTO CURSOR prelim NOFILTER HAVING Count(*) >= m.bonus GROUP BY OrderID
SELECT Count(*) AS countmorethan FROM prelim INTO CURSOR results