Last post Sep 14, 2018 02:54 AM by Ackerly Xu
Sep 13, 2018 04:47 PM|JagjitSingh|LINK
Can we use Inner join in below statement
SqlCommand sqlCommand = new SqlCommand("Select * from [Test] where Category = @Category", con);
Sep 13, 2018 06:40 PM|DA924|LINK
Yes you can use a Select with an inner join with what you are showing.
Sep 14, 2018 02:54 AM|Ackerly Xu|LINK
Yes , we could use inner join in ado.net.
When we want to retrieve data from two related tables , we usually consider inner join.
Do you have two tables?Or you only have one table?
If you only have one table we usually don't consider inner join unless you want to self join.(refer to
Below is a sample using inner join.
select * from categories c inner join products p on c.CategoryID=p.CategoryID where p.CategoryID=@categoryId
For more information about inner join, you could refer to https://www.w3resource.com/sql/joins/perform-an-inner-join.php