We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,099 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

self related table problem

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

2
Contributors
2
Replies
2 Hours
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
baig772
Junior Poster
155 posts since Mar 2011
Reputation Points: 29
Solved Threads: 10
Skill Endorsements: 0

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
smantscheff
Nearly a Posting Virtuoso
1,297 posts since Oct 2010
Reputation Points: 321
Solved Threads: 270
Skill Endorsements: 8
Question Answered as of 1 Year Ago by smantscheff

Thanks to all
Solved my problem :)

baig772
Junior Poster
155 posts since Mar 2011
Reputation Points: 29
Solved Threads: 10
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0605 seconds using 2.65MB