asp.net change gridview cell if two table columns got the same value

279 Views Asked by At

so i got this little issue with my gridview in asp.net and mysql: I have two tables with several columns. In both tables i have a Column ("Name").

I wanted to Show the whole Table 1 in my gridview and mark the rows that match the values in the second table in red or some other Colors.

I used the Right Join and can Display the matching result... but not the other records in table1 i wanted to Show (not matching records = Color green).

Can anyone help me with this Problem? or give a hint to a solution?

1

There are 1 best solutions below

0
On

You can used the inner join instead of right join to get only matching records

SELECT tbl1.Color FROM tbl1 INNER JOIN tbl2 ON tbl1.Name=tbl2.Name;