Hello,
select
*
from
re_agent agent inner join
re_property prop on
agent.agent_id = prop.agent_id left outer join
re_image image on
prop.propid = image.propid
In practice, inner join first, then outer join, or there can be unintended
consequences.
Once you use an inner join (or outer) you have to be consistent through-out the
query.
These types of queries are faster than the antiquated where clause style.
(particularly so if using MS SQL)
PS left outer joins can be performed with the old method. you use the =* syntax
(or is it *=). I don't use it so I don't know for sure.
Scott Thornton, Programmer
Application Development
Information Services and Telecommunications
Hunter-New England Area Health Service
p: +61 2 49813589
m: 0413800242
e: scott.thornton <at> hnehealth.nsw.gov.au
>>> [EMAIL PROTECTED] 22/03/2006 11:10:14 am >>>
On 22/03/06, Scott Thornton <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> If you wish to use one query only, and have to deal with 0-n images, then
> you will have to left outer join your Image table.
> eg
>
> select
> *
> from
> re_property prop left outer join
> re_image image on
> prop.propid = image.propid
>
>
Ah! I've never understood the whole outer/inner join bit, so I tend not to
use them. Probably why I tie my brain in knots trying to find an
alternative. :)
So if I then also wanted to get the agent data (which is easier since each
property must have 1 agent) would that involve another join of some sort, or
would it be like this:
select
*
from
re_property prop left outer join
re_image image on
prop.propid = image.propid,
re_agent agent
where
agent.propID = prop.propID
That's the way I've always handled such things in the past, but I'd like to
learn how to use joins properly if they're a better way of working it. :)
Cheers,
Seona.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" 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/cfaussie
-~----------~----~----~----~------~----~------~--~---