Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
chulz90
Starting Member
26 Posts |
Posted - 2013-04-08 : 00:19:56
|
hello..i've some trouble in my query. i just want to know the right one from this query belowi know the simple query is:select * from rspi_do where do_number like '%RS%';but i want to know how use like and substr ???select * from rspi_do where do_number like '%substr(RS-DI-02-00002,1,2)%';but teh result is nothing, i want to know where's the right one???can i use like and substr together?????thank's for helping |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-08 : 01:45:45
|
select * from rspi_do where do_number like '%'+substring(RS-DI-02-00002,1,2)+'%'; |
|
|
chulz90
Starting Member
26 Posts |
Posted - 2013-04-08 : 02:20:33
|
quote: Originally posted by bandi select * from rspi_do where do_number like '%'+substring(RS-DI-02-00002,1,2)+'%';
still errorT___T |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-08 : 02:29:34
|
which error? Is it error or incorrect result? |
|
|
chulz90
Starting Member
26 Posts |
Posted - 2013-04-08 : 03:40:07
|
it says error syntaxbut i've founded finally :Dselect * from rspi_do where do_number1,2 like '%'||substr(RS-DI-02-00002,1,2)||'%';thank's bandi for response |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-09 : 00:29:30
|
quote: Originally posted by chulz90 it says error syntaxbut i've founded finally :Dselect * from rspi_do where do_number1,2 like '%'||substr(RS-DI-02-00002,1,2)||'%';thank's bandi for response
I think you are working on Oracle/DB2... My solution is for SQL Server..Thats why you got the error...--Chandu |
|
|
|
|
|
|
|