If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Select query with Parent ID columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-12, 15:31
kalaiselvan328 kalaiselvan328 is offline
Registered User
 
Join Date: Mar 2011
Posts: 3
Select query with Parent ID columns

Hi,
I got a table with some questionnarie columns and some questions with sub_questions. For sub question rows Parent Question ID in assigned to parent_ID

Ex: TableA:

[sid] [gid] [qid] [ParentId] [SQID][questions]
AA 100 1 0 - Q1
AA 100 2 0 - Q2
AA 100 3 2 a q1
AA 100 4 2 b q2
AA 100 5 0 - Q3

From the above table I need the results with joining all the columns and questions.
Where as If qid comes in ParentId then qid row will not appear, but its question will concatenate with parentId row question and ID forms with ParentId and SQID

Expecting Result:
[ID] [Question]
AA-100-1 Q1
AA-100-2a Q2-q1
AA-100-2b Q2-q2
AA-100-5 Q3

Please help me in this to get the solution..

Regards,
Kalaiselvan R
Love Yourself First....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On