Nitu Dhaka
Nitu Dhaka

Reputation: 1330

Join with resulted table

p.slugUrl AS resultslug, p.id, m.slugUrl, m.categoryParent, pa.pageId, pa.categoryId from tcs_pagecontents as p,tcs_pageassociation as pa, tcs_menucategory_site as m where p.id=pa.pageId and pa.categoryId=m.id ;

This is returning a table with following structure( lets say this table as P)

resultslug
id
slugUrl
categoryParent
pageId
categoryId

Further I wanted to make a join with this resulted table to another table where P.categoryParent = T.id, here T is another table I wanted to fetch the following coloumn name

    P.resultslug
    P.id
    P.slugUrl
    P.categoryParent
    P.pageId
    P.categoryId
    T.slugUrl
where  P.categoryParent = T.id; 

I am getting blank here. Any Idea will be appreciated. Thanks in advance.

Upvotes: 0

Views: 46

Answers (1)

Fabricator
Fabricator

Reputation: 12782

Just join that table like the other ones.

select p.slugUrl AS resultslug, p.id, m.slugUrl, m.categoryParent, pa.pageId, pa.categoryId, T.slugURL 
from tcs_pagecontents as p
join tcs_pageassociation as pa on p.id=pa.pageId 
join tcs_menucategory_site as m on pa.categoryId=m.id
join another_table T on m.categoryParent = T.id;

Upvotes: 2

Related Questions