472,110 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,110 software developers and data experts.

Duplicate Return on rs

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
Mar 16 '07 #1
1 1271
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

"Simon Gare" <si***@simongare.comwrote in message
news:uU****************@TK2MSFTNGP03.phx.gbl...
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


Mar 16 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Lowell Kirsh | last post: by
reply views Thread by Gary Lundquest | last post: by
1 post views Thread by Gary Lundquest | last post: by
1 post views Thread by marx | last post: by
3 posts views Thread by shine | last post: by
4 posts views Thread by Shi Mu | last post: by
2 posts views Thread by Jeff Bohmer | last post: by
6 posts views Thread by teser3 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.