I am trying to calculate a value using an IF in a SQL statement. Below is what I am trying. I am not sure what is wrong with the IF. The error says missing operator.
SELECT
cr_401k_data_sheet1.`Department`,
SUM (cr_401k_data_sheet1.`Gross`) As Gross,
SUM (cr_401k_data_sheet1.`Contribution`) As Contribution,
SUM( cr_401k_data_sheet1.Gross*.05) As Limit,
(if SUM(Contribution) <> Limit then Contribution) As Match
FROM
`cr_401k_data_sheet1` cr_401k_data_sheet1
GROUP BY
cr_401k_data_sheet1.`Department`,
Thanks in advance,
vmonyou cannot use IF in crystal SQL, infect you cannot use IF in any SQL, untill you are using a stored procedure
how ever you can do this calulation in Crystal, from your query it seems like you want to calculate MACTH where Sum(Contribution) <> SUM(LIMIT), thats you can do in crystal by writing a formula.
Showing posts with label wrong. Show all posts
Showing posts with label wrong. Show all posts
Friday, February 24, 2012
Conditional calculation in SQL for CR
Friday, February 17, 2012
Concurrency violation error!
Hi
im keep getting the following error
im keep getting the following error
Concurrency violation: the UpdateCommand affected 0 recordsCan you post your problematic code here?I dunno whats wrong, im the only person using the database and program at the moment.
Anyone know what im doing wrong?thanks
Subscribe to:
Posts (Atom)