Click here to Skip to main content
15,901,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Comments
F-ES Sitecore 17-Sep-15 5:11am    
It's a SELECT with a JOIN. This is a very basic SQL question, google how to join tables for relevant articles.
Member 10528015 17-Sep-15 6:14am    
HI i Know it is very basic query. here is query that i have: "SELECT Users.UserName FROM Users INNER JOIN DealerShip ON Users.UserID = DealerShip.UserID". The only problem is that it is displaying the sama names for all the Dealers

1 solution

SELECT Users.UserName,dealership.dealershipname FROM Users INNER JOIN DealerShip ON Users.delearshipid = DealerShip.dealershipID and dealership.dealershipid = @dealershipid
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900