Bind without ParentID

3 posts, 0 answers
  1. Cal
    Cal avatar
    4 posts
    Member since:
    Oct 2010

    Posted 01 Nov 2010 Link to this post

    Hi,
      I realize this may be an odd question, but here is my situation, i have two tables:
    table1:
    stateid, statename

    table2:
    CountyId, CountyName, stateId

    I'm trying to have a structure like this:

    Statename
     --> CountyName

    my challenge is how to relate the two table to get the parentId. 

    I think the answer is simple but for some reason I just can't get the sql right.

    Regards,
    Cal
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 04 Nov 2010 Link to this post

    Hi Cal,

    Well, you need to add all records from table1 as records of table2.
    Also you need to transform table2:
     - CountyId will become just id;
     - stateId will become parentId (this column should be nullable as the records representing states should have null for it).

    From now on it's pretty straight-forward, isn't it?
    Hope this is helpful for you!


    Regards,
    Nikolay Tsenkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Cal
    Cal avatar
    4 posts
    Member since:
    Oct 2010

    Posted 04 Nov 2010 Link to this post

    Amaaazingly simple :)
Back to Top