Você pode utilizar expressão regular:
http://www.postgresql.org/docs/9.0/static/functions-string.html
Bruno E. A. Silva.
Analista de Sistemas.
Bacharel em Sistemas de Informação
Pós-graduando em Gerência de Projetos
Mestrando em Ciências da Computação
Certified Scrum Master
LPIC-1
SCJP, SE 6
Novell CLA
Novell DCTS ECR
DBA Postgres
-------------------------------
“A caixa dizia: Requer MS Windows ou superior. Então instalei Linux.” -
Sábio Desconhecido
"Alguns prestam serviço/consultoria de Qualidade, os outros vendem licença!"



2011/7/21 Marcelo Silva (IG) <marc...@ig.com.br>

>   Pessoal, tenho o seguinte select
>
>  SELECT * FROM TABELA
> WHERE (CAMPO1 LIKE ‘STRING_A%’)
> OR(CAMPO1 LIKE ‘STRING_B%’)
> OR(CAMPO1 LIKE ‘STRING_C%’)
>
>  Observe que tenho que fazer varios ORs com Like porque as strings são o
> inicio de palavras
>
>  Sei que o IN(‘STR_A’,’STR_B’,’STR_C’)
>
> seria mais eficiente e elegante, porem ele só me dá a opcao de string fixa
>  Existe outra forma de fazer o Select acima ?
>  Seria algo do tipo
>
>  SELECT * FROM TABELA
> WHERE (CAMPO1 IN(‘STR_A%’,’STR_B%’,’STR_C%’))
>
>
>
>
> Marcelo Silva
> --------------------------------------------------
> Desenvolvedor Delphi, PHP
> msn: marc...@ig.com.br
> cel.: (11) 9693-4251
>
> _______________________________________________
> pgbr-geral mailing list
> pgbr-geral@listas.postgresql.org.br
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
>
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a