I'm having difficulty writing a query as follows. I'm unsure if I need a
subquery, a union or if this isn't actually possible without using
temporary tables.
I have two tables for members.
Table 1 (members) Table 2 (payments)
+--++ +-+--+
| memno
Is this what you're after?
SELECT
COUNT(*) AS members,
SUM(IF(payment_type = 'creditcard', 1, 0)) AS pay_by_card
FROM
members
JOIN payments USING (memno)
GROUP BY group;
On 8/5/05, Russell Horn [EMAIL PROTECTED] wrote:
I'm having difficulty writing a query as follows. I'm unsure
Russell Horn wrote:
I'm having difficulty writing a query as follows. I'm unsure if I need a
subquery, a union or if this isn't actually possible without using
temporary tables.
I have two tables for members.
Table 1 (members) Table 2 (payments)
+--++
Thanks for the two incredibly fast responses, they were perfect -
problem solved.
Russell.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]