MYSQL JOIN SELECT Statment - omit duplicated
- by mouthpiec
Hi,
I am tying to join the following 2 queries but I am having duplicated .... it is possible to remove duplacted fro this:
(
SELECT bar_id, bar_name, town_name, bar_telephone,
(subscription_type_id *2) AS subscription_type_id
FROM bar, sportactivitybar, towns, subscriptiontype
WHERE sport_activity_id_fk =14
AND bar_id = bar_id_fk
AND town_id = town_id_fk
AND subscription_type_id = subscription_type_id_fk
)
UNION
(
SELECT bar_id, bar_name, town_name, bar_telephone,
subscription_type_id
FROM bar, towns, subscriptiontype
WHERE town_id = town_id_fk
AND subscription_type_id = subscription_type_id_fk
)
ORDER BY subscription_type_id DESC , RAND( )
Please note that I need to omit those duplicates that will have a lower subscription_type_id