Duplicate Return on rs

Discussion in 'ASP General' started by Simon Gare, Mar 15, 2007.

  1. Simon Gare

    Simon Gare Guest

    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
    Simon Gare, Mar 15, 2007
    #1
    1. Advertising

  2. Simon Gare

    Simon Gare Guest

    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" <> wrote in message
    news:uUl%...
    > 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
    >
    >
    Simon Gare, Mar 16, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PvdK
    Replies:
    0
    Views:
    2,960
  2. wl
    Replies:
    2
    Views:
    566
    Dimitri Maziuk
    Mar 5, 2004
  3. Ganesh Gella
    Replies:
    4
    Views:
    344
    Stuart Gerchick
    Nov 12, 2004
  4. Seong-Kook Shin
    Replies:
    1
    Views:
    472
    Richard Bos
    Jun 18, 2004
  5. Greenhorn
    Replies:
    15
    Views:
    783
    Keith Thompson
    Mar 6, 2005
Loading...

Share This Page