Results 1 to 8 of 8

Thread: SQL Join

  1. #1
    Join Date
    Jun 2011
    Posts
    5

    Unanswered: SQL Join

    Hi,

    I need help to to collect data from feedback tables.

    I have tables like

    1. tbl_parent_child_details

    fld_parent_id fld_parent_name fld_child_name fld_class fld_section
    1 Tom Ray 8 A
    2 Dev angelina 12 B

    2. tbl_feedback_children

    fld_parent_id fld_quetion_id fld_ans
    1 1 1
    1 2 3
    1 3 2
    2 1 4
    2 2 5
    2 3 2

    2. tbl_feedback_admini

    fld_parent_id fld_quetion_id fld_ans
    1 1 1
    1 2 3
    1 3 2
    2 1 4
    2 2 5
    2 3 2
    __________________________________________________

    Now my requirement is I want data of every parent in one row like:

    Parent child q1 q2 q3 q4 q5 q6
    tom ray 1 3 2 1 3 2
    dev angelina 4 5 2 4 5 2

    Any help is highly appreciated.

    Thanks,
    Shrawan

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    It would be helpful if you provided DDL (CREATE TABLE ...) for tables involved.
    It would be helpful if you provided DML (INSERT INTO ...) for test data.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jun 2011
    Posts
    5
    table 1 dml/ddl


    CREATE TABLE IF NOT EXISTS `tbl_parent_child_details` (
    `fld_id` int(11) NOT NULL ,
    `fld_parent_name` varchar(255) NOT NULL,
    `fld_child_name` varchar(255) NOT NULL,
    `fld_class` varchar(50) NOT NULL,
    `fld_section` varchar(10) NOT NULL,
    PRIMARY KEY (`fld_id`)
    )


    INSERT INTO `tbl_parent_child_details` (`fld_id`, `fld_parent_name`, `fld_child_name`, `fld_class`, `fld_section`) VALUES
    (2, 'Dineshar ', 'Sahu', '12', 'A'),
    (3, 'rawat', 'tinku', 'Foundation', 'A');

    tabl 2 dml/ddl

    CREATE TABLE IF NOT EXISTS `tbl_fb_children` (
    `fld_id` int(11) NOT NULL ,
    `fld_parent_child_details_id` int(11) NOT NULL,
    `fld_quetion_id` int(11) NOT NULL,
    `fld_ans` varchar(700) NOT NULL,
    PRIMARY KEY (`fld_id`)
    ) ;


    INSERT INTO `tbl_fb_children` (`fld_id`, `fld_parent_child_details_id`, `fld_quetion_id`, `fld_ans`) VALUES
    (16, 2, 1, '1'),
    (17, 2, 2, '2'),
    (18, 2, 3, '5'),
    (19, 2, 4, '4'),
    (20, 2, 5, '1'),
    (21, 2, 6, '3'),
    (22, 2, 7, '3'),
    (23, 2, 8, '4'),
    (24, 2, 9, '2');

    tabl 3 dml/ddl


    CREATE TABLE IF NOT EXISTS `tbl_fb_admin_sys` (
    `fld_id` int(11) NOT NULL ,
    `fld_parent_child_details_id` int(11) NOT NULL,
    `fld_quetion_id` int(11) NOT NULL,
    `fld_ans` varchar(700) NOT NULL,
    PRIMARY KEY (`fld_id`)
    )


    INSERT INTO `tbl_fb_admin_sys` (`fld_id`, `fld_parent_child_details_id`, `fld_quetion_id`, `fld_ans`) VALUES
    (18, 2, 1, '3'),
    (19, 2, 2, '5'),
    (20, 2, 3, '4'),
    (21, 2, 4, '2'),
    (22, 2, 5, '3'),
    (23, 2, 6, '4'),
    (24, 2, 7, '1'),
    (25, 2, 8, '2'),
    (

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    I seriously doubt that you actually executed the posted SQL (successfully).
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jun 2011
    Posts
    5
    I am using mysql db . And these statements working fine.

  6. #6
    Join Date
    Jun 2011
    Posts
    5

    SQL Join

    Hi,

    I need help to to collect data from feedback tables.

    I have tables like

    1. tbl_parent_child_details

    fld_parent_id fld_parent_name fld_child_name fld_class fld_section
    1 Tom Ray 8 A
    2 Dev angelina 12 B

    2. tbl_feedback_children

    fld_parent_id fld_quetion_id fld_ans
    1 1 1
    1 2 3
    1 3 2
    2 1 4
    2 2 5
    2 3 2

    2. tbl_feedback_admini

    fld_parent_id fld_quetion_id fld_ans
    1 1 1
    1 2 3
    1 3 2
    2 1 4
    2 2 5
    2 3 2
    __________________________________________________

    Now my requirement is I want data of every parent in one row like:

    Parent child q1 q2 q3 q4 q5 q6
    tom ray 1 3 2 1 3 2
    dev angelina 4 5 2 4 5 2

    Any help is highly appreciated.

    Thanks,
    Shrawan

  7. #7
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    THIS is an Oracle RDBMS Forum

    post this at MySQL :: MySQL Forums
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  8. #8
    Join Date
    Jun 2011
    Posts
    5
    Thanks and sorry for posting it in wrong forum.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •