Welcome Guest, Not a member yet? Register   Sign In
trouble with SQL bindings
#3

(This post was last modified: 11-12-2020, 01:21 AM by richb201.)

OK. I tried that. Now I am getting 24 rows as the result. Some of those rows are showing employees having activities that don't actually exist in sr. The AC filter didn't work at all.

The real question is why did the one without the bindings work and the with the bindings not work. I think CI has a way to see what the last SQL statement was. Perhaps the two created SQL statements are not the same? 

I used last_query and see this:
SELECT  srat.employee_email,srat.taxyear, sr.item, kt.qualified, kt.unqualified         
   FROM survey_results_activities_temp srat, survey_results sr, key_temp kt
            WHERE sr.user_email='[email protected]' AND sr.taxyear='2016' AND sr.item_type='AC' AND sr.item=kt.activity AND sr.taxyear=srat.taxyear

SELECT  srat.employee_email,srat.taxyear, sr.item, kt.qualified, kt.unqualified
            FROM survey_results_activities_temp srat, survey_results sr, key_temp kt
            WHERE sr.user_email=srat.employee_email AND sr.taxyear=srat.taxyear AND sr.item_type='AC' AND sr.item=kt.activity

The first one doesn't work. The second one works, but only returns the first employee's data. That would be fine since I could just run the query once for each employee. But how do I get it to run on the second employee (and the third, etc)? 
proof that an old dog can learn new tricks
Reply


Messages In This Thread
trouble with SQL bindings - by richb201 - 11-11-2020, 06:44 PM
RE: trouble with SQL bindings - by ojmichael - 11-12-2020, 12:21 AM
RE: trouble with SQL bindings - by richb201 - 11-12-2020, 12:40 AM
RE: trouble with SQL bindings - by ojmichael - 11-12-2020, 04:24 PM
RE: trouble with SQL bindings - by richb201 - 11-13-2020, 01:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB