¡Hi!, i have a case with two tables than can have a lot of matches entries and the time of fetching increases a lot.
This tables can be
Table A: Employees
-------------------------
| Name | ID | Account |
-------------------------
| Nicole | 01 | 12345 |
| Alexis | 02 | 67890 |
-------------------------
And Table B: BankAccounts
--------------------------
| Name | ID | Account |
--------------------------
| Nicole | 01 | 12345 |
| Nicole | 01 | 67890 | //duplicates Accounts
| Alexis | 02 | 67890 | //duplicates Accounts
--------------------------
And i want to do this with a Left Join in a Table that can have more of 450,000 different entries
Result Table C
Column_A = ¿Exists the account number in other register?
Column_B = if(NumberOfMatches > 1) //this means that the account be found
in other user AND i want to get the first value of all posibles number of matches
|Account exists in other user|Match in User..
-----------------------------------------------------------------------------
| Name | ID | Account | Column_A | NumberOfMatches | Column_B | BadID |
--------------------------------------------------------------------|-------|
| Nicole | 01 | 12345 | No | 1 | Nicole (OK) | null |
| Alexis | 02 | 67890 | Yes | 2 | Nicole (BAD)| 01 |
-----------------------------------------------------------------------------
Thanks and regards!
Note: sorry for my english, im learning :p
Best Answer
fiddle