OPERACIONES CON SELECT

18/08/2005 - 18:31 por CCALLOQUISPE PALOMINO | Informe spam
Hola:
En oracle tu puedes utilizar la siguiente consulta:

select name from emp
minus
select name from emp where C_DistCod='10'

en sql cual es su equivalente

muchas gracias por su ayuda
CCALLOQUISPE

Preguntas similare

Leer las respuestas

#1 Gustavo Larriera [MVP]
18/08/2005 - 18:45 | Informe spam
select Col1 from tableB
MINUS
select Col2 from tableA

puede hacerse en SQL Server así:

SELECT t1.Col1 FROM Table1 AS t1
WHERE NOT EXISTS( SELECT * FROM Table2 AS t2
WHERE t2.Col1 = t1.Col1 )

o también:

SELECT t1.Col1 FROM Table1 AS t1
WHERE t1.Col1 NOT IN( SELECT t2.Col1 FROM Table2 AS t2 )





Gustavo Larriera
Uruguay LatAm
Blog: http://sqljunkies.com/weblog/gux/
MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and confers
no rights.
"CCALLOQUISPE PALOMINO" wrote in message
news:
Hola:
En oracle tu puedes utilizar la siguiente consulta:

select name from emp
minus
select name from emp where C_DistCod='10'

en sql cual es su equivalente

muchas gracias por su ayuda
CCALLOQUISPE
Respuesta Responder a este mensaje
#2 CCALLOQUISPE PALOMINO
18/08/2005 - 19:22 | Informe spam
he utilizado esta consulta:

select
*
from
tsm_currcurso
where
C_FacCod='013'
and
C_EscCod='003'
and
C_EspCod='002'
and
C_AnoCurr='1997'
and
not exists
(
select
*
from
tsm_currcurso
where
C_FacCod='013'
and
C_EscCod='003'
and
C_EspCod='002'
and
C_AnoCurr='1997'
and
N_CicloCur='01'
)

el cual no sale fila alguna, el objetivo de esta consulta
es mostrar los cursos de los ciclos 2 al 5.

muchas gracias por su ayuda
CCALLOQUISPE


"Gustavo Larriera [MVP]" escribió:

select Col1 from tableB
MINUS
select Col2 from tableA

puede hacerse en SQL Server así:

SELECT t1.Col1 FROM Table1 AS t1
WHERE NOT EXISTS( SELECT * FROM Table2 AS t2
WHERE t2.Col1 = t1.Col1 )

o también:

SELECT t1.Col1 FROM Table1 AS t1
WHERE t1.Col1 NOT IN( SELECT t2.Col1 FROM Table2 AS t2 )





Gustavo Larriera
Uruguay LatAm
Blog: http://sqljunkies.com/weblog/gux/
MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and confers
no rights.
"CCALLOQUISPE PALOMINO" wrote in message
news:
> Hola:
> En oracle tu puedes utilizar la siguiente consulta:
>
> select name from emp
> minus
> select name from emp where C_DistCod='10'
>
> en sql cual es su equivalente
>
> muchas gracias por su ayuda
> CCALLOQUISPE



Respuesta Responder a este mensaje
#3 Gustavo Larriera [MVP]
19/08/2005 - 06:00 | Informe spam
No has brindado la estructura de la tabla tsm_currcurso y datos de prueba,
pero intentaré ayudarte.

Si lo que necesitas es mostrar los cursos de los ciclos 2 al 5, y entiendo
que los ciclos están en el campo N_CicloCur, podrías hacer:

SELECT *
FROM tsm_currcurso
WHERE N_CicloCur IN ('02', '03', '04', '05)
AND C_FacCod='013'
AND C_EscCod='003'
AND C_EspCod='002'
AND C_AnoCurr='1997'


Gustavo Larriera
Uruguay LatAm
Blog: http://sqljunkies.com/weblog/gux/
MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and confers
no rights.
"CCALLOQUISPE PALOMINO" wrote in message
news:
he utilizado esta consulta:

select
*
from
tsm_currcurso
where
C_FacCod='013'
and
C_EscCod='003'
and
C_EspCod='002'
and
C_AnoCurr='1997'
and
not exists
(
select
*
from
tsm_currcurso
where
C_FacCod='013'
and
C_EscCod='003'
and
C_EspCod='002'
and
C_AnoCurr='1997'
and
N_CicloCur='01'
)

el cual no sale fila alguna, el objetivo de esta consulta
es mostrar los cursos de los ciclos 2 al 5.

muchas gracias por su ayuda
CCALLOQUISPE


"Gustavo Larriera [MVP]" escribió:

select Col1 from tableB
MINUS
select Col2 from tableA

puede hacerse en SQL Server así:

SELECT t1.Col1 FROM Table1 AS t1
WHERE NOT EXISTS( SELECT * FROM Table2 AS t2
WHERE t2.Col1 = t1.Col1 )

o también:

SELECT t1.Col1 FROM Table1 AS t1
WHERE t1.Col1 NOT IN( SELECT t2.Col1 FROM Table2 AS t2 )





Gustavo Larriera
Uruguay LatAm
Blog: http://sqljunkies.com/weblog/gux/
MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and
confers
no rights.
"CCALLOQUISPE PALOMINO" wrote in message
news:
> Hola:
> En oracle tu puedes utilizar la siguiente consulta:
>
> select name from emp
> minus
> select name from emp where C_DistCod='10'
>
> en sql cual es su equivalente
>
> muchas gracias por su ayuda
> CCALLOQUISPE



Respuesta Responder a este mensaje
#4 CCALLOQUISPE PALOMINO
19/08/2005 - 18:57 | Informe spam
MUCHAS GRACIAS NO SE ME HABIA OCURRIDO
CCALLOQUISPE


"Gustavo Larriera [MVP]" escribió:

No has brindado la estructura de la tabla tsm_currcurso y datos de prueba,
pero intentaré ayudarte.

Si lo que necesitas es mostrar los cursos de los ciclos 2 al 5, y entiendo
que los ciclos están en el campo N_CicloCur, podrías hacer:

SELECT *
FROM tsm_currcurso
WHERE N_CicloCur IN ('02', '03', '04', '05)
AND C_FacCod='013'
AND C_EscCod='003'
AND C_EspCod='002'
AND C_AnoCurr='1997'


Gustavo Larriera
Uruguay LatAm
Blog: http://sqljunkies.com/weblog/gux/
MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
derecho / This posting is provided "AS IS" with no warranties, and confers
no rights.
"CCALLOQUISPE PALOMINO" wrote in message
news:
> he utilizado esta consulta:
>
> select
> *
> from
> tsm_currcurso
> where
> C_FacCod='013'
> and
> C_EscCod='003'
> and
> C_EspCod='002'
> and
> C_AnoCurr='1997'
> and
> not exists
> (
> select
> *
> from
> tsm_currcurso
> where
> C_FacCod='013'
> and
> C_EscCod='003'
> and
> C_EspCod='002'
> and
> C_AnoCurr='1997'
> and
> N_CicloCur='01'
> )
>
> el cual no sale fila alguna, el objetivo de esta consulta
> es mostrar los cursos de los ciclos 2 al 5.
>
> muchas gracias por su ayuda
> CCALLOQUISPE
>
>
> "Gustavo Larriera [MVP]" escribió:
>
>> select Col1 from tableB
>> MINUS
>> select Col2 from tableA
>>
>> puede hacerse en SQL Server así:
>>
>> SELECT t1.Col1 FROM Table1 AS t1
>> WHERE NOT EXISTS( SELECT * FROM Table2 AS t2
>> WHERE t2.Col1 = t1.Col1 )
>>
>> o también:
>>
>> SELECT t1.Col1 FROM Table1 AS t1
>> WHERE t1.Col1 NOT IN( SELECT t2.Col1 FROM Table2 AS t2 )
>>
>>
>>
>>
>>
>> Gustavo Larriera
>> Uruguay LatAm
>> Blog: http://sqljunkies.com/weblog/gux/
>> MVP profile: http://aspnet2.com/mvp.ashx?GustavoLarriera
>> Este mensaje se proporciona "COMO ESTA" sin garantias y no otorga ningun
>> derecho / This posting is provided "AS IS" with no warranties, and
>> confers
>> no rights.
>> "CCALLOQUISPE PALOMINO" wrote in message
>> news:
>> > Hola:
>> > En oracle tu puedes utilizar la siguiente consulta:
>> >
>> > select name from emp
>> > minus
>> > select name from emp where C_DistCod='10'
>> >
>> > en sql cual es su equivalente
>> >
>> > muchas gracias por su ayuda
>> > CCALLOQUISPE
>>
>>
>>



email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida