Welcome Guest, Not a member yet? Register   Sign In
Mysql query question about using active record
#1

[eluser]CodeIgniter Fan[/eluser]
I am developing matrimonial site on which I am query the database on multiple talbes which contains both AND & OR operator Now this is my query


SELECT DISTINCT pinfo.id, pinfo.name FROM partner_primary_info as pinfo INNER JOIN partner_religious_background relbackg ON pinfo.id=relbackg.candidate_id INNER JOIN partner_astro_data astro ON relbackg.candidate_id=astro.candidate_id INNER JOIN partner_family_details familyd ON astro.candidate_id=familyd.candidate_id INNER JOIN partner_life_style lifestyle ON familyd.candidate_id=lifestyle.candidate_id INNER JOIN partner_education_occupation eduocc ON lifestyle.candidate_id=eduocc.candidate_id INNER JOIN partner_residence resi ON eduocc.candidate_id=resi.candidate_id WHERE pinfo.gender = 'Male' AND pinfo.age >= '25' AND pinfo.age <= '27' AND pinfo.marital_status = 'Single' AND pinfo.no_of_children = 'None' OR pinfo.no_of_children = '' AND pinfo.height >= '4.05' AND pinfo.height <= '7.00' AND pinfo.physical_status = '2'


I am generating the query string using active record class now in the above query if I want to add brackets on both side of no_of_children field that I had shown bold above in query.

Is it possible to add brackets using active record class or database class ? I need it because otherwise my query doesn't produces expected result.


Messages In This Thread
Mysql query question about using active record - by El Forum - 01-12-2008, 08:11 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 08:22 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 08:25 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 09:01 AM
Mysql query question about using active record - by El Forum - 01-12-2008, 12:14 PM
Mysql query question about using active record - by El Forum - 01-14-2008, 06:05 AM
Mysql query question about using active record - by El Forum - 01-14-2008, 11:47 AM
Mysql query question about using active record - by El Forum - 08-29-2008, 12:14 AM
Mysql query question about using active record - by El Forum - 08-29-2008, 06:21 AM
Mysql query question about using active record - by El Forum - 08-31-2008, 08:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB