Duplicate Return on rs

S

Simon Gare

Hi all,

in my SQL select query I have a LEFT JOIN between 2 tables that returns a
value if the data from table 1 is present in table 2, below

dbo.booking_form.COLL_CONTACT_TEL = dbo.tblFlag.TelNoMo OR
dbo.booking_form.MOBILE_NO = dbo.tblFlag.TelNoMo

Problem is that if the COLL_CONTACT_TEL and MOBILE_NO are both present in
table 2 it returns the record twice in the asp page repeat region.

Can anyone help?

Regards

--
Simon Gare
The Gare Group Limited

website: www.thegaregroup.co.uk
website: www.privatehiresolutions.co.uk
 
S

Simon Gare

Just to expand

here's my problem, tried Select DISTINCT dbo.Flag.TelNoMo, etc, but error
read

"The text, ntext, or image data type cannot be selected as DISTINCT"

Full query is here


"SELECT dbo.booking_form.*, dbo.tblFlag.Flag, dbo.booking_form.ACCOUNT,
dbo.booking_form.TimeOfBooking, dbo.booking_form.VEHICLE_TYPE,
dbo.Customers.AccountNo, dbo.CarTypes.CarTypeID, dbo.CarTypes.ImageURL,
dbo.Customers.CompanyName FROM (((dbo.booking_form INNER JOIN dbo.CarTypes
ON dbo.booking_form.VEHICLE_TYPE = dbo.CarTypes.CarTypeID) ) INNER JOIN
dbo.Customers ON dbo.booking_form.ACCOUNT = dbo.Customers.AccountNo) LEFT
JOIN dbo.tblFlag ON (dbo.booking_form.COLL_CONTACT_TEL = dbo.tblFlag.TelNoMo
OR dbo.booking_form.MOBILE_NO = dbo.tblFlag.TelNoMo) WHERE allocated = '" +
Replace(BookingForm__MMColParam, "'", "''") + "' and timeofbooking >=
DateAdd(""hour"",-1, getdate()) ORDER BY TimeOfBooking ASC"

As you can see its complicated, would appreciate it if you have any
suggestions.

Regards
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,783
Latest member
RickeyDort

Latest Threads

Top