You need brackets around the ORs, otherwise it'll only join correctly on the 
first condition, and not the second two:

SELECT *
FROM tbl_meddelregos m, tbl_mdconfregoptions r
WHERE m.confregoptionid = r.confregoptionid
AND (m.confregoptionid = 1
     OR m.confregoptionid = 6
     OR cocktailparty > 0
    )
ORDER BY lastname


Alternatively, you could do it like this:

SELECT *
FROM tbl_meddelregos m
JOIN tbl_mdconfregoptions r ON (m.confregoptionid = r.confregoptionid) 
WHERE m.confregoptionid = 1
   OR m.confregoptionid = 6
   OR cocktailparty > 0
ORDER BY lastname




>I have some SQL which I am trying to get working
>
>Basically here is what I have:
>
>select *
>from tbl_meddelregos m, tbl_mdconfregoptions r
>where m.confregoptionid = r.confregoptionid and
>m.confregoptionid = 1 or
>m.confregoptionid = 6 or
>cocktailparty > 0
>order by lastname
>
>I keep on getting duplicate records in the output.
>
>Basically what I am trying to get
>
>I am joining 2 tables based on the confregoptionid (so as to get the code to
>display for the registration option).
>
>I then want to display all records which are m.confregoptionid = 1 (standard
>registration), m.confregoptionid = 6 (early bird registration) and then
>those records where a person has paid to attend the cocktail part (as it
>wasn't included automatically in the registration fee paid.
>
>Thanks in advance for replies.
>
>P

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272292
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to