Hi DP Members. I have this problem: I have a DB which contains this tables: 1. Table "category" : "id" "title" 2. Table "subcategory": "id" "category_id" "title" 3. Table "softare": "id" "subcategory_id" "title" ...... How can i make a query to the db where i get the last 10 softwares where the KATEGORY id = 3 I hope you can understand what i mean? Thank you
Based on what you are telling us, you CANNOT get the LAST 10 UNLESS you EITHER specify a FIELD containing a DATE or UNLESS you specify a SORT ORDER for KATAGORY id=3. Furthermore you are not telling us which DB engine you are using. Without knowing that there is no way you can get the correct answer except by accident.
sort order by id (software table) this is mysql i think 4.1 version. if you need any other details, let me know.
SELECT * FROM software LEFT JOIN subsubcategory ON subcategory.subcategory_id = software.subcategory_id LEFT JOIN category ON category.id = subcategory.category_id WHERE category.id = 3 SORT BY id DESC LIMIT 0,10 Code (markup): You'll have to run it yourself and see if there are any problems, but you get the idea.