You could possibly do a UNION query? If you need to know which table they
came from, add a hard-coded value to the field list ('TableA' as
which_table).

SELECT id, firstname, lastname FROM tableA where email = '[email protected]'
UNION
SELECT id, firstname, lastname FROM tableB where email = '[email protected]'

It's the same as doing two queries, but joining the result set might be
faster in the DBMS than joining two arrays with PHP; I've not checked to
see.

Richard

On Tue, Apr 14, 2009 at 4:47 AM, Dave Maharaj :: WidePixels.com <
[email protected]> wrote:

>  I have come into a situation where I need to find something that will be
> in either TableA or TableB. Is there an easy way to do this or do i need to
> query TableA if no results query TableB?
>
> thanks,
>
> Dave
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to