Hello!
I don't even know what to search in google for this question, so I hope someone here can help.
What I want to do is:
I have two tables: Clients and Log
they both have ID field which is the same
Clients table has list of all clients with their details and there is field called IsActive that determine if client should be shown or not.
Log table got list of some Clients ID's but not all the Clients table ID's so if Clients table has 10 clients, Log table can have from 1 - 10 clients id's in it.
I want to do some kind of JOIN or something that will select all the clients from Clients Table and set their IsActive status to be T/F depends on if their ID is exist in the Log table.
For example:
Clients table:
Log Table:
Query result will be:
1 exist in Log table
2 not exist in Log table so it set to False
3 exist in Log table
4 not exist in Log table so it set to False
5 exist in Log table so it became True even if it was False
6 exist in Log table so it became True even if it was False
It will return Clients table but IsActive values will change depends on if that ID exist in Log table.
You can see the red values that was changed because client id was in Log table.
The result table IsActive row has nothing to do with the Clients table IsActive, it will be created by the query.
I am using SQL CE, C# 4.5
Please help! I don't have a clue how to do it :confusion:
Thanks!
I don't even know what to search in google for this question, so I hope someone here can help.
What I want to do is:
I have two tables: Clients and Log
they both have ID field which is the same
Clients table has list of all clients with their details and there is field called IsActive that determine if client should be shown or not.
Log table got list of some Clients ID's but not all the Clients table ID's so if Clients table has 10 clients, Log table can have from 1 - 10 clients id's in it.
I want to do some kind of JOIN or something that will select all the clients from Clients Table and set their IsActive status to be T/F depends on if their ID is exist in the Log table.
For example:
Clients table:
ID | Name | IsActive |
1 | Dan | True |
2 | Bruce | True |
3 | John | True |
4 | Bob | True |
5 | Arthur | False |
6 | Jack | False |
Log Table:
ID |
1 |
3 |
5 |
6 |
Query result will be:
ID | Name | IsActive |
1 | Dan | True |
2 | Bruce | False |
3 | John | True |
4 | Bob | False |
5 | Arthur | True |
6 | Jack | True |
1 exist in Log table
2 not exist in Log table so it set to False
3 exist in Log table
4 not exist in Log table so it set to False
5 exist in Log table so it became True even if it was False
6 exist in Log table so it became True even if it was False
It will return Clients table but IsActive values will change depends on if that ID exist in Log table.
You can see the red values that was changed because client id was in Log table.
The result table IsActive row has nothing to do with the Clients table IsActive, it will be created by the query.
I am using SQL CE, C# 4.5
Please help! I don't have a clue how to do it :confusion:
Thanks!