Skip to content
Advertisement

Limit the results returned by MySQL join to 1

I’m doing a JOIN on two tables and the right side has multiple results for the ON clause: e.ID = ti.event_id. How do I limit the results returned by the join to 1? Sort of like LIMIT 1

events_detail tbl:

events_start_end tbl:

Current query:

Actual results:

Preferred results:

Advertisement

Answer

Use ROW_NUMBER():

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement