0
I know it’s supposed to be simple, but I’m having a hard time getting through this. I have a table called "enterprise". In this table, I have 4 specific fields that store different ID’s from other records in the same table.
Example of the enterprise table. The values of the fields do not follow the same order, it was just to illustrate:
id relacionado1 relacionado2 relacionado3 relacionado4
10 15 16 17 18
15 10 16 17 18
16 15 10 17 18
17 15 16 10 18
I need to select, showing for example, all records with id equal to the fields of the related tables1, related2, related3, related4.
How do I do that? I’m not getting it any way. Thanks in advance!
explain to me why you save data from different ID’s from other records in that same table? This is the only way to do what you need to do?
– DNick
It’s kind of hard to understand what you want. I think your data modeling has not been done well. Do you want the table rows where the related fields1, related2, related3 and related4 are the same? Put in your example data that provides an expected return and which would be it.
– anonimo
whereas it is mere
WHERE valor = relacionado1 AND valor = relacionado 2
or evenWHERE relacionado1 = relacionado2 AND relacionado2 = relacionado3 AND ...
, it would be important to [dit] putting the attempt and describing what went wrong to see where the problem is.– Bacco