Red 09 Posted November 3, 2003 Share Posted November 3, 2003 I\'m trying to make a \'most recent entries\' list for my intranet site. I want his list to show the last 10 entries from 3 or more tables. I only want it to show entries the user has access to (I use a very simple function to check the users access level in the category for each entry). I can\'t figure out how to make a mysql query that returns certain fields from the 3 or more tables, and sorts them after the \'date published\'-field in each table, and filters out expired items based on the \'expire date\'-field (the names of these fields are not the same in all the tables). If I can get this far, I\'m going to try and make a loop in php that checks the users access against each entry in the result untill 10 are found. Can anyone help? Link to comment https://forums.phpfreaks.com/topic/1278-seeking-help-with-getting-resultset-from-multiple-tables/ Share on other sites More sharing options...
sirmanson Posted November 13, 2003 Share Posted November 13, 2003 I would recommend storing some sort of access level in your tables and letting mySQL filter the results based on that. select t1.*,t2.*, t3.* from table1 t1, inner join table2 t2 on t1.id=t2.id inner join table3 t3 on t2.id=t3.id where t1.user_level<=$user_level and t2.user_level<=$user_level and t2.user_level<=$user_level order by t1.date_published Link to comment https://forums.phpfreaks.com/topic/1278-seeking-help-with-getting-resultset-from-multiple-tables/#findComment-4488 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.