dbTalk Databases Forums  

Question about joining tables

comp.databases.theory comp.databases.theory


Discuss Question about joining tables in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
bissatch@yahoo.co.uk
 
Posts: n/a

Default Question about joining tables - 02-22-2008 , 05:26 PM






Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy

Reply With Quote
  #2  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM






bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #3  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #4  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #5  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #6  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #7  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #8  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #9  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
  #10  
Old   
Bob Badour
 
Posts: n/a

Default Re: Question about joining tables - 02-22-2008 , 06:11 PM



bissatch (AT) yahoo (DOT) co.uk wrote:

Quote:
Hi,

Say I have two tables, one called property which stores details of
properties, and anothe called property_image that stores a single
image for a property. So either property may have one image or no
image. I know how to do the following join:

SELECT * FROM property, property_image WHERE property.property_id =
property_image.property_id

Works fine if I need only returned the properties that tie up with
images but the properties that dont tie up I dont get returned in my
result. Is it possible to create an SQL joining statement where all
properties would be returned including the ones that dont have an
property image? Those that dont just wouldnt have any values in the
property_image.* columns. Traditionally I would do a query on the
property table then for each property do a single SELECT lookup on the
property_image table .. im sure for performance if i could reduce this
to one query i would see an improvement.

Thanks

Burnsy
See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
unions but more people know outer joins than know unions for some reason.)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.