Hi all
I have following table structure

pk_cat_id(int)     cat_name(varchar)     cat_desc(text)    fk_cat_id(int)

table is self related as one to many

i want to select cat_name, cat_desc and parent_cat_name()
i.e.
from fk_cat_id, how i can get cat_name

Recommended Answers

Presumably it's

select child.cat_name, child.cat_desc, parent.cat_name
from mytable child, mytable parent
where child.pk_cat_id = parent.fk_cat_id
Jump to Post

All 2 Replies

Presumably it's

select child.cat_name, child.cat_desc, parent.cat_name
from mytable child, mytable parent
where child.pk_cat_id = parent.fk_cat_id
commented: explanatory :) +3

Thanks to all
Solved my problem :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.