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 |
|
kranken
Starting Member
1 Post |
Posted - 2010-03-20 : 10:15:43
|
| Hello,I wrote a following sql query and it works fine except for parameters like drying%Total, drying%1, drying%2. The reason is that in the name of parameters there is a wildcard used %(oracle DB). I know that I can use an escape command however I could not figure out how as I think that escape command only works with LIKE operator and not MAX. Could you please help me to resolve this problem?Thank you in advance for your help.SELECT c.numlotpharma AS lotnum , c.numof , MAX(DECODE(RTRIM(a.parametercode),'DRYING',numvalue,0)) AS dryingdata,MAX(DECODE(RTRIM(a.parametercode),'DRYING%Total',numvalue,0)) AS dryingpercentageTotal,MAX(DECODE(RTRIM(a.parametercode),'DRYING%1',numvalue,0)) AS dryingpercentage1,MAX(DECODE(RTRIM(a.parametercode),'DRYING%2',numvalue,0)) AS dryingpercentage2, FROM prodaccount.manufacturingdata aINNER JOIN (SELECT MAX(inputindex) AS inputindex, parametercode , mancode FROM prodaccount.manufacturingdata WHERE parametercode IN ('DRYING') GROUP BY parametercode, mancode) b ON a.inputindex = b.inputindexAND a.parametercode = b.parametercodeAND a.mancode = b.mancodeINNER JOIN (SELECT Numlotpharma, numof , codeproduit FROM prodaccount.batchlotdetails d WHERE d.codeproduit = ('Tablets')) c ON a.mancode = c.numofGROUP BY c.numlotpharma, c.numofORDER BY lotnum |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-03-20 : 11:01:37
|
| i haven't worked with Oracle for a bit, but try using double quotes instead of single"DRYING%Total" |
 |
|
|
|
|
|
|
|