0
I’m creating a recognition system for the company and it was almost over, it’s been some time that I’m trying to carry out this consultation but not getting.
I have the following tables:
Collaborator: id_colab, nome_colab and other data that I will not use in this query.
Ex: (5, "Gabriel de Almeida"); (6, "Jose da Silva");
In this table I have registered values of recognition keys
keyfix: id_key,name_key
Ex: (12, "Kindness");
And last I have a table where I only have a foreign key:
key_users: id_keyu,value_keyu (foreign key from keyfix), user_create_keyu (foreign key from Contributor), user_recieve_keyu(foreign key from Contributor).
Ex: (1, 12, 5, 6);
In the query I needed to bring the name of the key (in the example "Gentileza") the name of the collaborator who receives and what is delivering but when I run this query does not return me anything:
SELECT id_keyu,name_key,nome_colab FROM keys_users,keyfix,colaborador WHERE id_key = value_keyu AND id_colab = user_recieve_keyu AND id_colab = user_create_keyu;
But in this case I get duplicate records containing the "recieve" and the "create".
– Gabriel Almeida