vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I need your help. I wrote following query: select NODE, PORT, MTIME, VALUE_A, VALUE_B, VALUE_C from TABLE where (NODE, PORT) in (*****) (select NODE, PORT from TABLE where ( VALUE_A > 0 or VALUE_B > 0 or VALUE_C > 0 ) and MTIME >=dateadd(day,-5,getdate()) group by NODE, PORT having count(*)>4 ) What is wrong? Maybe (*****) ? Thank you for your help. michael |
| ||||
| With "in" you can only use one value in the subquery: select col1 from table1 where col2 in (select col2 from from table2 where .....) You can try instead: select NODE, PORT, MTIME, VALUE_A, VALUE_B, VALUE_C from TABLE where ( VALUE_A > 0 or VALUE_B > 0 or VALUE_C > 0 ) and MTIME >=dateadd(day,-5,getdate()) group by NODE, PORT having count(1)>4 "michael" <michael_pakard@yahoo.de> a écrit dans le message de news:1cf6e7be.0311240656.532bcb89@posting.google.c om... > Hi, > I need your help. I wrote following query: > > select NODE, PORT, MTIME, VALUE_A, VALUE_B, VALUE_C > from TABLE > where (NODE, PORT) in (*****) > (select NODE, PORT from TABLE > where > ( > VALUE_A > 0 > or VALUE_B > 0 > or VALUE_C > 0 > ) > and > MTIME >=dateadd(day,-5,getdate()) > group by NODE, PORT > having count(*)>4 > ) > > What is wrong? Maybe (*****) ? > > Thank you for your help. > michael |