Re: Question about joining tables



SELECT *
FROM property p LEFT OUTER JOIN property_image pi
ON p.property_id = pi.property_id

Use the newer ansi join syntax. DBMS systems are deprecating
the older style join you're using

--
Sincerely,
John K
Knowledgy Consulting
http://knowledgy.org/

Atlanta's Business Intelligence and Data Warehouse Experts


<bissatch@xxxxxxxxxxx> wrote in message
news:853f063c-3ba8-4455-a7b4-814b13623005@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Question about joining tables
    ... one called property which stores details of ... images but the properties that dont tie up I dont get returned in my ... to one query i would see an improvement. ...
    (comp.databases.theory)
  • Re: multi table multi database join?
    ... dont i have some kind of filter? ... sybase runns on one machine mssql on another, ... the data from the aggregate db could be used in a query to ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: What to do with a Null Value that is returned from a Select. ??
    ... but I dont seem to be able catch it properly. ... > SqlConnection myConnection = new SqlConnection ... > //Run Query to compare the Email Address ... > The HTML is simple and just contains a text box. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Employee Emergency
    ... I dont want to be a burden but i have another problem but this time it has ... > listbox/combobox) the order ID to match to an employee, then the query ... > step, i.e. first just the tables and the orderID filter, then the group ...
    (microsoft.public.access.queries)
  • RE: returning multiple values in a MAX qry
    ... "DawnTreader" wrote: ... no i dont have 2 entries on the same date. ... and october 25 both show up in the second query when i run it. ... gather the data for the sub form is showing 2 records for one compressorID ...
    (microsoft.public.access.queries)