Sam Teng Wong
Sam Teng Wong

Reputation: 2439

mysql Sorting by Event Name

I'm going straight to the point here.

I'm doing a query where I sort the result by event name however some of the event name has html tag on it.. how can I disregard the tag and go straight on sorting to it's actual name.

here's my query:

 SELECT * FROM 
 events 
 INNER JOIN venue
 ON venue.venue_id=events.venue_id
 INNER JOIN countries
 ON countries.country_id=events.country_id
 WHERE events.display = '1' 
 AND events.active = '1' 
 ORDER BY events.event_name_en ASC

but in my database there's a html tag.

the inter airport should not be there since it starts with letter I. but my query returns that result since it targets the html tag.

my question is: how can I disregard the html tag and sort directly on the actual event name? thanks in advance

enter image description here

Upvotes: 0

Views: 39

Answers (1)

Jakob
Jakob

Reputation: 3546

Do it like this:

ORDER BY REPLACE(REPLACE(events.event_name_en,'<i>',''),'<u>','') ASC

Upvotes: 1

Related Questions