-2
I need to make a query
in the mysql
, within the WHERE
I need you to contain the COD_IDENT
within a group. That is:
COD_IDENT
5
6
7
My query
need to return all results where COD_IDENT
be equal to 5,6,7
I tried to do using in
but it returns only one result. Actually it was to return two.
I did it this way:
SELECT COD_IDENT_REUNI, COD_IDENT_SALAX
FROM tbl_REUNIOES WHERE COD_IDENT_EMPRE = 'ibhr' and COD_IDENT_SALAX in
(SELECT COD_IDENT_SALAX, max(DAT_IDENT_REUNI)
FROM tbl_REUNIOES WHERE COD_IDENT_EMPRE = 'ibhr' GROUP BY (COD_IDENT_SALAX))
Renan, could you add more details about your question? The other tables, which relations and etc. It is easier to help you. Basically you want an IN of distinct values, which could be solved with
SELECT DISTINCT COD_IDENT FROM tbl_IDENTIFICACAO WHERE FLG_STATUS = 'S'
, but post more information, to facilitate in aid. DISTINCT– Fernando A.W.
@Fernandoa.W. What I need is all in one table, because next in this table there are several MEETINGS, and EACH MEETING IS A ROOM need to pick up the most recent meeting of each room. Suppose we have 4 rooms, and each room had 10 meetings, I need to pick up the extra with the longer date.
– Renan Rodrigues
I updated the question
– Renan Rodrigues
See if it fits your problem.
– Fernando A.W.