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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 sql query with condition

Author  Topic 

sunpalozzi
Starting Member

9 Posts

Posted - 2005-07-19 : 14:38:55
hello all,
I wonder if anyone can help me with this query. I am trying to do a query in store procedure includes some condtions:

select id, name, sum(iif(month(bookingdate()) = 1, total_prod, 0)) as jan_prod
from production
group by id
order by id

I am getting a syntax error. It works for other basebase program. What will be the correct syntax for what I am trying to do here??? thank you.

Sherry

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-07-19 : 14:44:31
IIF is access, not sql server. go to start, programs, sql server, sql server books online, contents, transact sql reference, CASE and do some reading.

Sean Roussy

Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.

I am available for consulting work. Just email me through the forum.
Go to Top of Page

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-07-19 : 15:06:08
This person had the nerve to email me directly and spit on my post (see below)...

Sherry,

I could have given you a fish and you would have eaten for a day but I was trying to teach you to be self reliant so you can eat for a lifetime. If you have a job writing SQL I suggest you read SQL Server Books Online as soon as possible. I am sorry I did not write you a big long reply with flowery speech but I have a job to do too.

"Hello Thrasymachus

You received the following message from: sunpalozzi (EDIT: email address removed)

At: http://www.sqlteam.com/forums/

Thank you for yout attitude."


Sean Roussy

Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.

I am available for consulting work. Just email me through the forum.
Go to Top of Page
   

- Advertisement -