activerecord
activerecord copied to clipboard
Field values equal to each other
Great plugin!
Here's my code and you'll see what I'm trying to do:
where:exp_forms_entries.member_id="{member_id}"
or_where:exp_forms_entries.fid_1010="exp_forms_entries.fentry_id"
It's evaluating the "exp_forms_entries.fentry_id" as a string, rather than database field. Possible?
Can you try this?
where:exp_forms_entries.member_id="{member_id}"
or_where[]="exp_forms_entries.fid_1010 = exp_forms_entries.fentry_id"
Don't think it worked...here's query:
Maybe it's too early in the morning for me, but that query looks right. Or am I missing something?
Ok, you're right! Computer is doing what I told it to do...not what I want it to do. See attached. I went to the database and ran the same query there for checks. See attached. I'm trying to find where two separate entries have the same id, in different columns.
So, after doing some digging, what I'm trying to do is a subquery. Here's the actual query that I want to perform. Is is possible with your plugin?
SELECT `exp_forms_entries`.`form_id`, exp_forms_entries.fid_1002, exp_forms_entries.fid_1010, exp_forms_entries.fentry_id, exp_forms.form_title
FROM (`exp_forms_entries`)
INNER JOIN `exp_forms` ON `exp_forms_entries`.`form_id` = `exp_forms`.`form_id`
WHERE `exp_forms_entries`.`member_id` = 2
OR exp_forms_entries.fid_1010 IN (SELECT fentry_id from exp_forms_entries )
note: member_id would be passed-in as a variable
I think or_where[]="exp_forms_entries.fid_1010 IN (SELECT fentry_id from exp_forms_entries )" would work.
worked!! You da man! This is best plugin ever.