I have a problem with the return of a simple query
Table San_ChaveBematech
ID Chave_Id Credenciada_Id Recibo Impresso
55 571678 10 Test 0
Table San_CadastraBematech
ID Maquina Credenciada
5 000FEAB63D89 10
6 003067D6A4E7 10
7 003067D6A4D4 10
Query That I has some problem
SELECT San_ChaveBematech.Recibo
FROM San_ChaveBematech
JOIN San_CadastraBematech
ON San_ChaveBematech.Credenciada_Id = San_CadastraBematech.Credenciada
WHERE San_ChaveBematech.Credenciada_Id =
(SELECT top 1 credenciada
FROM San_CadastraBematech
WHERE maquina = '000FEAB63D89')
AND San_ChaveBematech.Impresso = 0
How It Works
I have an application (Windows Form) where my user will be registered. I’ll save her register in my San_CadastraBematech table. In my web application I can get some keys and, when I get it, I’ll save the data in San_ChaveBematech table. To print it, I do the query that I put here, but look, I have just one register in San_ChaveBematech but my query return the same register 3 times.
Can somebody help me ?
1 Answer