$if1 = "IF(s.student_e thnicity_intere st_other IS NOT NULL AND
s.student_ethni city_interest_o ther != '', " .
" CONCAT(s.studen t_ethnicity_int erest_other, ', ',
GROUP_CONCAT(e. ethnicity_name ORDER BY upper(e.ethnici ty_name))), " .
' GROUP_CONCAT(e. ethnicity_name ORDER BY
upper(e.ethnici ty_name))' .
" ) AS ethnicity_name \n\n";
This segment of a larger SQL query produces a string that normally
looks like these:
caucasians
caucasians,afri can-americans
caucasians,afri can-americans,asian-americans
Nordic peoples,caucasi ans
"etc"
Here's the problem. Requirement states that we now need to filter the
results by "ethnicity" , which is a one-to-many relationship per
applicant.
Let's say you have 20 applicants, and out of those, 1 of those has just
"caucasians " for ethnicity.
When you do the filter which I envision as:
WHERE ... AND ethnicity_name LIKE '%caucasians%'
Instead of having this value in the $result[$i]->ethnicity_na me field
resultset value:
caucasians
You see this:
caucasians,cauc asians,caucasia ns,caucasians,c aucasians..[repeated 7
times]
Take out the filter and it displays just fine.
I am not sure how much more info I can provide; the query itself is
about 200 lines long and is under U.S. Government regulated security
(illegal to post it, sorry), unfortunately this is all I can think of
that is allowable to post that illustrates the problem.
Should note there there is an "ethnicity" table with 7 rows in it with
unique ethnicity names like "caucasians ", "african-americans", etc.,
and a field in the "applicant" table that is
"applicant_ethn icity_interest_ other" where you can enter whatever
ethnicity you want on top of the selected ethnicities in the
"ethnicity" table - if that helps.
Thanx
Phil