dbTalk Databases Forums  

subquery - need your help

comp.databases.sybase comp.databases.sybase


Discuss subquery - need your help in the comp.databases.sybase forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
michael
 
Posts: n/a

Default subquery - need your help - 11-24-2003 , 08:56 AM






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

Reply With Quote
  #2  
Old   
j_martinez
 
Posts: n/a

Default Re: subquery - need your help - 11-24-2003 , 01:02 PM






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 (AT) yahoo (DOT) de> a écrit dans le message de
news:1cf6e7be.0311240656.532bcb89 (AT) posting (DOT) google.com...
Quote:
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



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.