MySQL: Issue joining two tables -
so i'm trying select 5 random rows category_event table, match fk_event_id category_event table id events table, , order 5 random rows start_time events table.
i have 25 rows in category_event table fk_category_id=2, when run query returns 5 rows, next time 4 rows, next time 5 rows, next time 3 rows, etc. should 5 every time...
this have:
select * ( select fk_event_id category_event fk_category_id=2 , status = 'enabled' order rand() limit 5 ) c inner join events e on e.id = c.fk_event_id order e.start_time;
any appreciated :)
turns out had rows in category_event had fk_event_id's pointing non existing rows in events.
everything's :)
Comments
Post a Comment