Good morning to all, this question has the purpose of finding how I can generate an indicator of existence when the record is repeated: because the application has been previously generated, then I show the related query:
SELECT id AS Existe
FROM baja_products
WHERE
idGridCheck = '65860'
AND Aprob_ResG_Abast = 'True'
AND Aprob_ResG_Finan = 'True'
AND Aprob_ResG_Gnral = 'True'
AND Aprob_ResG_Legal = 'True'
ORDER BY 1 DESC;
Now the table in question already has two records pq previously approved the process for that item and presents the following scenario:
When it goes more than one row, the conditional does not give me the existence indicator correctly, so it skips the validation immersed in the Where.
The question is related to what I can do to give priority to order by or how can I put my where to find the match if there is a more recent record always take the last mentioned?
I hope you can help me, greetings and many thanks to all.