Hi Guys
I am trying to select and display on the RadGrid. i am using sqlDataSource. i have 2 Tables (Users and DealerShip). User table i have attributes (UserID(pk),UserName,Email,Phoneand DealerShipID(fk)) on DealerShip table i have attributes (DealerShipID(pk),DealerShipName) and now here is what i want to do. on my grid i will have a drill down like a treeView, the DealerName will be like a masterview where you drill down you can find all the users that belong to that specific DealerShip, for example i will have three Dealers (a,b,c) which have different users under each, Business Rule (one user can only belong to i Dealership and one Dealership can have many users.) please can one assist on how to right a SELECT statement which will display all the users per Dealership?

Thanks.

Recommended Answers

All 2 Replies

Something like this:

SELECT 
    d.DealerShipID, 
    d.DealerShipName, 
    u.UserID, 
    u.UserName,
    u.Email,
    u.Phoneand 
FROM DealerShip d 
    LEFT JOIN Users u 
    ON u.DealerShipID = d.DealerShipID
    WHERE d.DealerShipName IN('a', 'b', 'c');

Hi AndrisP,

see attached after using the same method you send, it is still giving me the same User for all the DealerShip whereas the is deferent users for each Dealer.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.