Re: [PHP] is this use of subquery "smart"

2009-02-04 Thread Chris
Bastien Koert wrote: On Wed, Feb 4, 2009 at 4:33 PM, Chris > wrote: Solution 2: SELECT r.reg_id, r.date_registered, r.old_record, if(r.ghost_record!=0, (SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people, registrant

Re: [PHP] is this use of subquery "smart"

2009-02-04 Thread Bastien Koert
On Wed, Feb 4, 2009 at 4:33 PM, Chris wrote: > > > Solution 2: >> SELECT r.reg_id, r.date_registered, r.old_record, if(r.ghost_record!=0, >> (SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people, >> registrants WHERE people.instance_id=12 and >> people.person_id=registrants.perso

Re: [PHP] is this use of subquery "smart"

2009-02-04 Thread Chris
Solution 2: SELECT r.reg_id, r.date_registered, r.old_record, if(r.ghost_record!=0, (SELECT CONCAT(people.last_name, ', ', people.first_name) FROM people, registrants WHERE people.instance_id=12 and people.person_id=registrants.person_id AND registrants.reg_id=r.ghost_record), 'y') as regis

[PHP] is this use of subquery "smart"

2009-02-04 Thread Afan Pasalic
What would be more "appropriate" way to create a query: Solution 1: select records from registrants table SELECT r.reg_id, r.date_registered, r.old_record FROM registrants r WHERE r.org_id=12 AND r.reg_status=0 AND r.reg_id=r.person_id # php "validation" if($old_record != 0) { SELECT CONCAT(