Q: Php Mysql Classifieds list stuck bx_ads_category  (Main Categories Table)
ID | Name
1  | Job
9  | Property
11 | General

bx_ads_category_subs  (Sub Categories Table)
ID | IDClassified | NameSub
85 | 1            | Developer
86 | 1            | Accountant
87 | 9            | For Sale
88 | 11           | For Rent

bx_ads_main  (Classifieds List Table)
ID | IDClassifiedsSubs | Subject | etc.
10 | 85                | A Company need Php Developer
11 | 85                | B Company need Php Developer
12 | 86                | C Company need Accountant
13 | 88                | Lux Apartment

I need list like that
SELECT * FROM bx_ads_category WHERE ID = 1

Result
10 = A Company need Php Developer
11 = B Company need Php Developer
12 = C Company need Accountant


A: I think you can have your result with a join query as follow
SELECT * 
FROM bx_ads_category a
INNER JOIN bx_ads_main b
ON a.IDClassifiedsSubs = b.ID
INNER JOIN bx_ads_category c
ON b.IDClassified = c.ID
WHERE c.ID = 1 


A: SELECT m.id, m.subject
  FROM bx_ads_main m JOIN bx_ads_category_subs s 
    ON m.IDClassifiedsSubs = s.ID JOIN bx_ads_category c
    ON s.IDClassified = c.ID
 WHERE c.ID = 1

Output:

| ID |                      SUBJECT |
|----|------------------------------|
| 10 | A Company need Php Developer |
| 11 | B Company need Php Developer |
| 12 |    C Company need Accountant |

Here is SQLFiddle demo
