Get all Records from table1 and the correspond values from table3 verify MId table2

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bethanabatla
    New Member
    • Dec 2010
    • 2

    #1

    Get all Records from table1 and the correspond values from table3 verify MId table2

    Table 1
    ID Information
    1 This is Key
    2 This is Ball
    3 This is Bike
    4 This is Pen
    5 This is Car

    Table 2
    ID Member
    1 Chandra
    2 Prasad
    3 Rajesh

    Table 3
    ID Id.Member Id.Infromation
    1 1 5
    2 1 1
    3 2 2
    4 3 1
    5 1 3
    6 3 4
    7 2 3

    ID : Primary Key

    Send the MemberID for Eg: IDà1 Depending on the ID Value Result Like This.


    InformationId Information IsSelected
    1 This is key True
    2 This is Ball False
    3 This is Bike True
    4 This is pen False
    5 This is Car True

    So I need all the information of table1 and the related selected items from table 3 while sending the memberId.

    Using SQLSERVER 2008 Need SQL Query for getting this table
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Try using JOIN. Post what you have and we can start from there...

    Happy Coding!!!

    ~~ CK

    Comment

    • Bethanabatla
      New Member
      • Dec 2010
      • 2

      #3
      Thankx for giving reply
      Here i am using Join like this geting all the infromation in table3 with table1 with Ischeck true or false

      SELECT T1.ID As InfromationID,I nfromation,
      CASE WHEN MemberId= @MemberId(Eg=1) THEN 'TRUE' ELSE 'FALSE' END AS IsChecked
      FROM tbltable1 T1 LEFT JOIN tbltable3 T3 ON
      T1.InfromationI D = T3.InfromationI D

      for example : in table 3 member 1 and 3 selected information 1
      table having 2 rows for this and givng the correct member astrue and othe one false.
      that is the problem i am facing.

      thankx in advance

      Comment

      • ck9663
        Recognized Expert Specialist
        • Jun 2007
        • 2878

        #4
        On your result, where did the InformationId came from?

        ~~ CK

        Comment

        Working...