Thursday, March 22, 2012

Clause where in [Select... ?

Hi,
I would like that instrucion bellow bring me all solicitations which
quotation is in the select clause where in.
It gives me error at this part in [Select Cotacao from Cotacoes Where
Pedido = P1]
Thanks,
Vilmar
Select * From
Solicitations
Where
Sc_Cotacao in [Select Cotacao from Cotacoes Where Pedido = P1]
Solicitations
Code CodeQuotation
S1 C1
S2 C1
S3 C1
S4 C2
S5 C2
S6 C2
S7 C3
S8 C3
S9 C3
Quotation
Code CodeRequest
C1 P1
C2 P1
C3 P1
Pedidos
P1
P2
P3
««««««««»»»»»»»»»»»»»»
Vlmar Brazão de Oliveira
Desenvolvimento Web
HI-TECSounds like P1 should be a string literal
Select * From
> Solicitations
> Where
> Sc_Cotacao in [Select Cotacao from Cotacoes Where Pedido = 'P1']
Wayne Snyder MCDBA, SQL Server MVP
Computer Education Services Corporation (CESC), Charlotte, NC
(Please respond only to the newsgroups.)
I support the Professional Association for SQL Server
(www.sqlpass.org)
"Vilmar Brazão de Oliveira" <suporte@.hitecnet.com.br> wrote in message
news:OAXMBnxwDHA.1912@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I would like that instrucion bellow bring me all solicitations which
> quotation is in the select clause where in.
> It gives me error at this part in [Select Cotacao from Cotacoes Where
> Pedido = P1]
> Thanks,
> Vilmar
> Select * From
> Solicitations
> Where
> Sc_Cotacao in [Select Cotacao from Cotacoes Where Pedido = P1]
>
> Solicitations
> Code CodeQuotation
> S1 C1
> S2 C1
> S3 C1
> S4 C2
> S5 C2
> S6 C2
> S7 C3
> S8 C3
> S9 C3
> Quotation
> Code CodeRequest
> C1 P1
> C2 P1
> C3 P1
> Pedidos
> P1
> P2
> P3
> ««««««««»»»»»»»»»»»»»»
> Vlmar Brazão de Oliveira
> Desenvolvimento Web
> HI-TEC
>|||You will get better responses if you post the actual error message.
Assuming that your query is the one posted, the select statement used with
IN should be bounded with parentheses, not brackets
"Vilmar Brazão de Oliveira" <suporte@.hitecnet.com.br> wrote in message
news:OAXMBnxwDHA.1912@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I would like that instrucion bellow bring me all solicitations which
> quotation is in the select clause where in.
> It gives me error at this part in [Select Cotacao from Cotacoes Where
> Pedido = P1]
> Thanks,
> Vilmar
> Select * From
> Solicitations
> Where
> Sc_Cotacao in [Select Cotacao from Cotacoes Where Pedido = P1]
>
> Solicitations
> Code CodeQuotation
> S1 C1
> S2 C1
> S3 C1
> S4 C2
> S5 C2
> S6 C2
> S7 C3
> S8 C3
> S9 C3
> Quotation
> Code CodeRequest
> C1 P1
> C2 P1
> C3 P1
> Pedidos
> P1
> P2
> P3
> ««««««««»»»»»»»»»»»»»»
> Vlmar Brazão de Oliveira
> Desenvolvimento Web
> HI-TEC
>|||Thank you everybody!
It was switch square brackets by parentheses.
Regards,
Vilmar
Brazil
"Scott Morris" <bogus@.bogus.com> escreveu na mensagem
news:uzakf7xwDHA.2520@.TK2MSFTNGP10.phx.gbl...
> You will get better responses if you post the actual error message.
> Assuming that your query is the one posted, the select statement used with
> IN should be bounded with parentheses, not brackets
> "Vilmar Brazão de Oliveira" <suporte@.hitecnet.com.br> wrote in message
> news:OAXMBnxwDHA.1912@.TK2MSFTNGP09.phx.gbl...
> > Hi,
> > I would like that instrucion bellow bring me all solicitations which
> > quotation is in the select clause where in.
> > It gives me error at this part in [Select Cotacao from Cotacoes Where
> > Pedido = P1]
> > Thanks,
> > Vilmar
> >
> > Select * From
> > Solicitations
> > Where
> > Sc_Cotacao in [Select Cotacao from Cotacoes Where Pedido = P1]
> >
> >
> > Solicitations
> > Code CodeQuotation
> > S1 C1
> > S2 C1
> > S3 C1
> > S4 C2
> > S5 C2
> > S6 C2
> > S7 C3
> > S8 C3
> > S9 C3
> >
> > Quotation
> > Code CodeRequest
> > C1 P1
> > C2 P1
> > C3 P1
> >
> > Pedidos
> > P1
> > P2
> > P3
> >
> > ««««««««»»»»»»»»»»»»»»
> > Vlmar Brazão de Oliveira
> > Desenvolvimento Web
> > HI-TEC
> >
> >
>

No comments:

Post a Comment