php - my Sql query to select 2 records per each category -
i have 2 tables. 1. news table 2. category table.
in news table have id, title, category id in category table have id , category name.
in news table there many news items multiple news items each category.
what need select 2 record per each category news table, need join 2 tables, can name of category category table. tried using below query
select * ( select news.id, news.fk_lookups_category, lookups_category.name, news.title, news.description,news.datetime,lookups_category.priority news join lookups_category on news.fk_lookups_category=lookups_category.id news.ispublished='1' , news.datetime >= ('today' - interval 7 day) order datetime desc ) newitem order priority
Comments
Post a Comment