| How to join two where? [message #568654] |
Mon, 15 October 2012 09:23  |
 |
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 #568656 is a reply to message #568655] |
Mon, 15 October 2012 09:28   |
 |
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
|
|
|
|
|
|