You need to do an outer join, something like this:

SELECT     *
FROM         dbo.Indx LEFT OUTER JOIN
                      dbo.Op ON dbo.Indx.Op_ID = dbo.Op.Op_ID LEFT OUTER
JOIN
                      dbo.Operator ON dbo.Indx.Operator_ID =
dbo.Operator.Operator_ID
WHERE     (dbo.Indx.Indx_ID = #theLot.Indx_ID#)


----- Original Message -----
From: "Brian Scandale" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, February 16, 2002 4:42 PM
Subject: query troubles


> I have a query that I'm not sure how to do...
>
> Essentially, this query works properly and returns one row.
>
> IF Indx.Operator_ID_In has a match in the Operator table. Otherwise it
returns zero rows.
>
> Is there a proper way to write this query so that it returns one row, with
the Operator fields empty if there is no match. (which is what I need it to
do.)
>
>
> SELECT *
> FROM Indx, Op, Operator
> WHERE Indx_ID = #theLot.Indx_ID#
> AND Op.Op_ID = Indx.Op_ID
> <!--- --->AND Operator.Operator_ID = Indx.Operator_ID_In
> 
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server · PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation · $99/Month · Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to