Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have the following problem:
In a table with web data, containing different type of IDs. Each of the rows has only one of these IDs. Example:
WebData:
IDType1 | IDType2 | IDType3 | Visits |
---|---|---|---|
123456 | - | - | 1 |
- | ABCDEF | - | 3 |
- | - | U7634JULM | 2 |
- | FEDGDE | - | 1 |
4564564 | - | - | 3 |
I also have a Users table which contain a master UserID + the other IDs for that particular user. Example
Users (the IDs in red match the IDs from the WebData table):
MasterID | IDType1 | IDType2 | IDType3 |
---|---|---|---|
1A | 123456 | QSDFQS | SDFU97994D |
2A | 345345 | ABCDEF | HJG654HGH |
3A | 678678 | GFHFDG | U7634JULM |
4A | 121321 | FEDGDE | VBNVN4343 |
5A | 4564564 | CVXCVXC | SDF4645DF |
What I want to achieve is add the MasterID in the WebData. It would be easy (for me at least) to join it if there was only 1 webID which I would need to match with the MasterID, but I'm struggeling to get this done.
So basically, I would need to end up with this:
WebData:
IDType1 | IDType2 | IDType3 | Visits | MasterID |
---|---|---|---|---|
123456 | - | - | 1 | 1A |
- | ABCDEF | - | 3 | 2A |
- | - | U7634JULM | 2 | 3A |
- | FEDGDE | - | 1 | 4A |
4564564 | - | - | 3 | 5A |
What would be the best approach to achieve this?
Kind regards,
Christophe
Hello,
I did a solution with three left joins one for each kind of ID and got the result needed.
This is for recognize the user for each type of social network he use to login on your app?
Hello,
I did a solution with three left joins one for each kind of ID and got the result needed.
This is for recognize the user for each type of social network he use to login on your app?
Great stuff Jean, thanks !!! Did the trick for me.. If I knew it would be that simple.. 🙂