September 1, 2005 at 7:56 am
Hi there i have another IIf function problem. I am trying to work out the VAT amount for sold stock units and am hoping someone can tell me the sql equivalent to the VBA:
VAT: IIf([SIV]>[ActualSellingPrice],([SIV]*0),IIf([New]<0,[ActualSellingPrice]*(7/47),([ActualSellingPrice]-[SIV])*(7/47)))
Thanks
Armo
September 1, 2005 at 8:07 am
Hi Niall,
R u looking for the sql query with case else end clause?
Nivedita
September 1, 2005 at 8:31 am
Hi Nivedita
Yes please,
I thought it was to do with case and else end, but am having difficulty putting the sql together.
Niall
September 1, 2005 at 8:49 am
SELECT CASE WHEN SIV > ActualSellingPrice THEN 0 ELSE CASE WHEN NEW < 0 THEN ActualSellingPrice * 7 / 47 ELSE (ActualSellingPrice - SIV) * 7 / 47 END END AS ColName FROM dbo.YourTable
September 1, 2005 at 9:05 am
Thanks again, it all starts to make sense when i see the correct syntax
September 1, 2005 at 9:32 am
Check the books online. It's really like "if/else" but with a mix of "select case" .
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy