Hello,
I have a MySQL table that has (among other fields) an affiliate_id,
affiliate_sub_i d, and a response_code field.
- affiliate_id stores the unique number of each of my affiliates.
- affiliate_sub_i d stores the affiliate ID of their affiliates.
- response_code holds a number between 1 - 6.
I have an affiliate (e.g., 1000). For affiliate 1000, I would like to
return an array with three columns:
SubID Response_1 Response_2
Each row returned, should contain each affiliate_sub_i d for affiliate_id
= '1000'. Response_1 should count how many "1" SubID had, and Response_2
should count how many "2" SubID had.
Below is the code I wrote, but I get the following error in phpMyAdmin:
"WHERE affiliate_id = '1000' AND application_"
SELECT affiliate_sub_i d AS SubID,
COUNT( response_code ) = '1' AS Response_1,
COUNT( response_code ) = '2' AS Response_2,
FROM table
WHERE affiliate_id = '1000'
AND application_dat e >= '2004-11-01'
AND application_dat e <= '2004-11-29'
I'm stuck. Any suggestions? :-)
Thanks,
Adam
I have a MySQL table that has (among other fields) an affiliate_id,
affiliate_sub_i d, and a response_code field.
- affiliate_id stores the unique number of each of my affiliates.
- affiliate_sub_i d stores the affiliate ID of their affiliates.
- response_code holds a number between 1 - 6.
I have an affiliate (e.g., 1000). For affiliate 1000, I would like to
return an array with three columns:
SubID Response_1 Response_2
Each row returned, should contain each affiliate_sub_i d for affiliate_id
= '1000'. Response_1 should count how many "1" SubID had, and Response_2
should count how many "2" SubID had.
Below is the code I wrote, but I get the following error in phpMyAdmin:
"WHERE affiliate_id = '1000' AND application_"
SELECT affiliate_sub_i d AS SubID,
COUNT( response_code ) = '1' AS Response_1,
COUNT( response_code ) = '2' AS Response_2,
FROM table
WHERE affiliate_id = '1000'
AND application_dat e >= '2004-11-01'
AND application_dat e <= '2004-11-29'
I'm stuck. Any suggestions? :-)
Thanks,
Adam
Comment