Home » SQL & PL/SQL » SQL & PL/SQL » How to join two where? (Oracle 11g)
How to join two where? [message #568654] Mon, 15 October 2012 09:23 Go to next message
UZUMAKI
Messages: 7
Registered: October 2012
Junior Member
Good staff,

I'm having trouble in a query, and reminded me of you.

Right now I want to create a query with only the junction of these two queries:

- select id_utilizador,nbeneficiario,nome from adm_utilizadores a WHERE exists ( select 1 from adm_util_grupos b where
a.id_utilizador = b.id_utilizador and b.id_grupo = '1') ;

- SELECT b.*,rownum as row_num FROM ADM_UTILIZADORES b ORDER BY $sidx $sord
WHERE row_num BETWEEN $start AND $end";

Virtually want id_utilizador, nome, and nbeneficiario, I can get the first query, ordered me returning the first 10. Someone can help me?
Re: How to join two where? [message #568655 is a reply to message #568654] Mon, 15 October 2012 09:23 Go to previous messageGo to next message
BlackSwan
Messages: 23134
Registered: January 2009
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: How to join two where? [message #568656 is a reply to message #568655] Mon, 15 October 2012 09:28 Go to previous messageGo to next message
UZUMAKI
Messages: 7
Registered: October 2012
Junior Member
SELECT id_utilizador, 
       nbeneficiario, 
       nome 
FROM   (SELECT b.*, 
               rownum AS row_num 
        FROM   adm_utilizadores b 
        ORDER  BY id_utilizador ASC) a 
WHERE  EXISTS (SELECT 1 
               FROM   adm_util_grupos b 
               WHERE  a.id_utilizador = b.id_utilizador 
                      AND b.id_grupo = '1') 
       AND row_num BETWEEN 1 AND 10; 


if I'm not mistaken, already got. Someone confirm me whether it is correct?

*BlackSwan added {code} tags. Do so yourself in the future

[Updated on: Mon, 15 October 2012 09:32] by Moderator

Report message to a moderator

Re: How to join two where? [message #568658 is a reply to message #568656] Mon, 15 October 2012 09:33 Go to previous message
BlackSwan
Messages: 23134
Registered: January 2009
Senior Member
since we don't have your table or data & don't know exactly what you desire for the answer, we can't judge the validity (or not) of posted SQL.

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Previous Topic: How to fetch value which column has timestamp datatype?
Next Topic: Test Case Builder
Goto Forum:
  


Current Time: Thu Dec 18 01:24:00 CST 2014

Total time taken to generate the page: 0.05529 seconds