Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where to put brackets and < >

Status
Not open for further replies.

newtosql

Programmer
Joined
Apr 7, 2003
Messages
18
Location
US
I have an if statement that I need to alter but Im unsure of where to put the ( )'s and <>

IF (SELECT COUNT(msecs) FROM [tablename] WHERE (CONVERT(int, msecs)/1000)/3600 >2 )>=1
BEGIN ......

I need &quot;>2&quot; part show greater than 1 and less than 3.

Thanks for you help!
 
that statement needs at least two conditions but you have only one

One for WHERE clause for example WHERE (CONVERT(int, msecs)/1000)/3600 BETWEEN 1 AND 2

Second for the IF statement and in this case it is for count of 'msecs'

IF ( SELECT ... ) > 1 -- or something other

Zhavic


---------------------------------------------------------------
In the 1960s you needed the power of two Comodore64s to get a rocket to the moon. Now you need a machine which is a vast number of times more powerful just to run the most popular GUI.
 
NewToSQL,

Please don't double post. You already have a thread going on this topic.

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top