Link to home
Create AccountLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

I need to Select a calculated value

My query has two decimal values, so I want to subtract one from the other


select TOP 100 *, IPOST-IDATE as Diff from MYTABLE

where IDATE<>IPOST


What syntax error is here?

Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Looks syntactically okay to me.  Is SQL Server reporting a syntax error or something else?

ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Update: Are you talking about the Synergy?
If yes, are you able to connect to the underlying SQL engine?

>> What syntax error is here?

When posting a question and you are getting (syntax) errors - post the message you're getting.


As mentioned above, what you posted does not have a syntax fault. The query is running fine: http://sqlfiddle.com/#!18/55d5c/1

Some sql engines complain about using * and some lithe fields in the same select. Try changing this to "mytable.*" and see if that helps.

@curiouswebster - It was actually some special character? Wondering how you got it there in the first place. Anyway, since you got a couple of questions from our members, a feedback comment from you would be appreciated. Thanks!