Help! This is driving me crazy. CASE statement report syntax error (missing operator)

Hi
Can anyone help with this SQL statement please. It uses a
CASE statement but I keep getting back a syntax error (missing
operator) error message. The SQL statement works without the CASE
statement, so everything else is fine - its just when I put the
CASE statement back in.
Here's the SQL statement:-
SELECT transactions.ourRef, transactions.transDate, CASE WHEN
transactions.transTypeID = 2 THEN transactionDetails.goodsVatable *
-1 ELSE transactionDetails.goodsVatable END,
transactionDetails.goodsNonVat, transactionDetails.VAT,
transactionDetails.grandTotal, clients.clientCode,
transTypes.transTypeDesc
FROM transactions, transactionDetails, clients, transTypes
WHERE transactions.transID = transactionDetails.transID
AND transactions.clientID = clients.clientID
AND transactions.transTypeID = transTypes.transTypeID
TransID = 2 means that its a credit not instead of an
invoice, therefore I want the goods vatable returned as a negative
number.
Thanks in advance.
Wez

quote:
...the client wishes for me to use an MS Access db
Too bad you didn't say that to begin with. I believe that
with Access you might consider using IIF().
Syntax:
IIf(expr, truepart, falsepart)
SELECT transactions.ourRef,
transactions.transDate,
IIf(transactions.transTypeID = 2,
transactionDetails.goodsVatable * -1,
transactionDetails.goodsVatable),
transactionDetails.goodsNonVat,
transactionDetails.VAT,
transactionDetails.grandTotal,
clients.clientCode,
transTypes.transTypeDesc
FROM transactions, transactionDetails, clients, transTypes
WHERE transactions.transID = transactionDetails.transID
AND transactions.clientID = clients.clientID
AND transactions.transTypeID = transTypes.transTypeID
Phil

Similar Messages

  • HT3951 I purchased a movie and it downloaded to my computer but it is not on my ipod and it will not sync manually. It showes upin my purchased list on ipod but not in my videos. HELP THIS IS DRIVING ME CRAZY

    I purchased a movie and it downloaded to my computer but it is not on my Ipod touch. It will not sync manually, I've tried. It shows up on my ipod as purchased but it is not in my videos. When I go to the movie from purchases it says DOW in the corner.HELP THIS IS DRIVING ME CRAZY

    Hello,
    If you have an iPod Touch you can watch movies on it.
    Did you sync the movie with iTunes between your computer and your iPod ?
    Connect iPod touch to a USB 2.0 port on your Mac or PC using the included cable.
    Follow the onscreen instructions in iTunes to set up iPod touch and sync your music, video, photos, and other content.
    Your computer must be connected to the Internet.
    By default, iTunes automatically syncs all songs and videos in your iTunes library to iPod touch. If you have more content in your library than will fit on iPod touch, iTunes alerts you that it can’t sync your content. You’ll need to use iTunes to select some of your songs, videos, and other content to sync.

  • Please help, this is driving me crazy

    I bought a new song just to use as a ring tone on my iphone and it wont let me create it.
    I made sure i'm signed in, have the view ringtone setting enabled, and
    have the latest version of itunes.
    the error i get is " This song cannot be made into a ringtone
    nothing hurts by various artists can no longer be made into a ringtone" and this happened with any song i purchase from itunes

    pls consider stating the actual specific issue in the Title of your post - people tend NOT to take the time to read a post that says 'Has this happened to you?' or the like - so your more likely to be viewed if you be more specific. Generic 'help, how do you fix this?' type titles are getting old for the rest of us as well. Thanks.

  • Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy!

    Every time I sync my Iphone 5c(with ios 8) to Itunes, it 1. deletes all of my purchased music 2. deletes all of my album artwork 3. replaces all of my deleted songs. please help! this is driving me crazy! It syncs 100+ songs, when I only want to sync 1! I'm running Itunes 11.3.1.2

    After having experienced similar problems and having it back to work, I have a few suggestions:
    - Try to find out if the syncing stops at a particular track or song. That might - out of the blue - have gotten corrupted in one way or another. Since that song will not be on the iPod, iTunes will try over and over to put it on and crash in one way or another;
    - reformat the iPod as described in the iTunes 9 crash-thread. It takes time (at first it seems to do nothing, but that is because the green bar is moving with very small steps);
    HTH

  • TS3899 I cannot select an email to delete on my IPhone 5. When I hit edit then check the email i wish to delete it unchecked itself. Help it is driving me crazy. I tried deleting the email account and re-adding it but it didn't work.

    I cannot select an email to delete on my IPhone 5. When I hit edit then check the email i wish to delete it unchecked itself. Help it is driving me crazy. I tried deleting the email account and re-adding it but it didn't work.

    Sorry if I confused you. Let me try again:
    1) do a full backup your iPhone to a PC using iTunes
    2) go to: settings, general, reset, erase all content and settings.erase phone.
    3) when iPhone starts again choose set as new phone. Do not restore from icloud or iTunes.
    4) once done. Setup your email accounts. When done, verify checked emails do not uncheck themselves.
    That resolved, finish setting up:
    5) go to: settings, icloud, uncheck email, and set other icons as wished. Now setup icloud account.
    6)This step will make all contracts reside in icloud and be available always:  Once icloud account is setup, go back to settings, email contacts. Open each email account and uncheck contacts, but leave mail checked. Then go to the icloud email account and check contacts.

  • My i tunes is skipping like a scratched cd-help please its driving me crazy..

    my  i tunes is skipping like a scratched cd….please help it is driving me crazy...

    If no change after restoring with iTunes as a new iPhone or not from your iPhone's backup, more than likely your iPhone has a hardware problem. You can make an appointment at an Apple store if there is one nearby.

  • How to find invalid statements(not syntax error) executed using v$ views

    Hi
    I want find invalid statements(not syntax error statements) that executed, when some of the applications runs in the server,
    for eg: permissions denied, table/view doesn't exit .. etc
    I could not able to find it in v$sql views. is there any other view that gives this information?

    V$ views only contain parsed statements, not incorrect ones.
    Max

  • Need help in this sql query to use Case Statement

    hi All,
    I have the below query -
    SELECT DISTINCT OFFC.PROV_ID
    ,OFFC.WK_DAY
    ,CASE
    WHEN OFFC.WK_DAY ='MONDAY' THEN 1
    WHEN OFFC.WK_DAY ='TUESDAY' THEN 2
    WHEN OFFC.WK_DAY ='WEDNESDAY' THEN 3
    WHEN OFFC.WK_DAY ='THURSDAY' THEN 4
    WHEN OFFC.WK_DAY ='FRIDAY' THEN 5
    WHEN OFFC.WK_DAY ='SATURDAY' THEN 6
    WHEN OFFC.WK_DAY ='SUNDAY' THEN 7
    END AS DOW
    ,OFFC.OFFC_OPENG_TIME
    ,OFFC.OFFC_CLSNG_TIME
    FROM GGDD.PROV_OFFC_HR OFFC
    WHERE OFFC.PROV_ID='0000600'
    WITH UR;
    this query is bringing results in 6 differnt rows with opening and closing time for each day separately. I want to generate the data in one row with each day having opening and closing time, so for 7 days, total 14 columns with opening and closing time. But i am not able to do that using case statement.
    can somebody help me in achieving that.
    thanks,
    iamhere

    Hi,
    Welcome to the forum!
    That's called a Pivot .
    Instead of having 1CASE expression, have 14, one for the opening and one for the closing time each day, and do GROUP BY to combine them onto one row.
    SELECT       OFFC.PROV_ID
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_OPENG_TIME END)     AS mon_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='MONDAY'    THEN OFFC.OFFC_CLSNG_TIME END)     AS mon_cls
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_OPENG_TIME END)     AS tue_opn
    ,       MIN (CASE WHEN OFFC.WK_DAY ='TUESDAY'   THEN OFFC.OFFC_CLSNG_TIME END)     AS tue_cls
    FROM        GGDD.PROV_OFFC_HR OFFC
    WHERE       OFFC.PROV_ID     = '0000600'
    GROUP BY  offc.prov_id
    ;This assumes there is (at most) only one row in the table for each distinct prov_id and weekday. If not, what do you want to do? Post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data.
    The staement above works in Oracle 8.1 and up, but there's a better way (SELECT ... PIVOT) available in Oracle 11. What version are you using? (It's always a good idea to include this when you post a question.)
    Edited by: Frank Kulash on Jan 6, 2011 8:22 PM

  • Every time I've tried to open my hotmail today, an H&R Block site pops up trying to get me to buy their tax prep software and I can't find a way around it. This is driving me crazy. Please help.

    Every time I've tried to open my hot mail today the page is usurped by H&R Block, trying to get me to buy their tax prep software and I don't see a way to close it out.

    No, it doesn't come up in any other browser. The interesting thing this morning was I had inadvertently doubleclicked my hotmail icon and two windows came up, one over the other. The first one had the H&R Block site that is driving me crazy, which I closed, but the second one had my dear old emails without the dreaded H&R Block takeover. I haven't been able to send a picture of the page, but it looks like an H&R Block web site and lists the various tax prep software and prices. You can navigate all around the site, too.

  • How do I stop the constant stars coming out of the firefox symbol - please help - they are driving me crazy

    ''locking this thread as the Owner of this thread answered in the related thread''
    starting today when I clicked on firefox on my mac, there are blue stars constantly coming out of the firefox symbol and they are annoying and driving me crazy. How do I stop the constant stars coming from the firefox symbol? please help

    You can use these steps to disable the snippets on the about:home page:
    * Set the <b>browser.aboutHomeSnippets.updateUrl</b> pref to an empty string on the <b>about:config</b> page
    * Open about:home page in a tab
    * Open Web Console in this tab (Firefox menu button or Tools > Developer)
    * Run this command via the command prompt: <b>gSnippetsMap.clear()</b>
    * Close the tab with the about:home page
    * Close and restart Firefox

  • Oh my gosh this is driving me crazy.

    fios has been great, for two years. recently this problem keeps coming back!!
    whenever the landline receives a phone call or dials, the internet goes off! I have to manually connect otherwise it
    stays OFF!!!!
    I thought it was just temporary but it's been doing that for almost two months!!
    it's driving me crazy!!!! can somebody do something???????????
    thanks in advance!
    Solved!
    Go to Solution.

    regardless if you knowingly changed somethng or not.... follow the steps...
    I bet 5 bucks your issue will be resolved
    Bob Robertson - Lighter Klepto - I steal lighters, not bandwith

  • Use Of "#EC CI_EXECSQL in ABAP with EXEC SQL. Statement giving Syntax Error

    Dear Gurus,
    I have encountered an issue while trying to remove warning for using Native SQL statement using pseudo comment "#EC CI_EXECSQL
    The thing is like this -- i have used follwing native sql command in abap.
    EXEC SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    Now when i am checking this code in code inspector it is showing a warning with information below
    CA CL_CI_TEST_CRITICAL_STATEMENTS0006
    Code Inspector
    Critical Statements
    Use of Native SQL
    Authorization checks cannot be appropriately run using EXEC SQL and should be carried out at program level.
    The message can be hidden using the pseudo-comment "#EC CI_EXECSQL
    Use of exceptin handling section for that warning showing me to use :
    The message can be hidden using pseudo
    comment      "#EC CI_EXECSQL
    Now when I am using "#EC CI_EXECSQL in the abap like below :
    EXEC SQL. "#EC CI_EXECSQL
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    It is giving syntax error
    The text literal ""#EC CI_EXECSQL        " is longer than 255
    characters.Check whether it ends correctly.
    Please provide the guideline to resolve this issue.
    Thanks & regards
    Saifur Rahaman.

    Hi Saifur,
    You can remove the warning using the following syntax:
    EXEC "#EC CI_EXECSQL
      SQL.
        CONNECT TO 'SURROUND_DB'
      ENDEXEC.
    At least, it worked fine for me when using OPEN CURSOR, SELECT, FETCH and so on statements.
    The way to use the pseudo comment is not very intuitive, but at least for my examples worked fine.
    I hope this may help you.
    Best regards,
    Edgardo G. König

  • I keep getting this message when I open my outlook mail - syntax error in arguments.  What is it and how do I fix it?

    I keep getting the message - syntax error in arguments when I open Outlook.  Why? And how do I correct it? 

    Hi,
    I don't know the exact fix for your problem, but there is a thread on the Microsoft answers page that talks about this error message being related to a particular key.
    And if you remove that key, you can fix Windows update. See below for the detailed information and scroll to the bottom to see where someone found the fix:
    http://answers.microsoft.com/en-us/windows/forum/windows_other-windows_update/windows-update-error-code-80072ee2/fb87f203-69d9-4cd5-bbb1-ba8d0781be3e
    Thanks,
    Michelle

  • Ethernet/Wireless internet problems..This is Driving me CRAZY..please help!

    Alright i hope someone out there can solve my problem because i am about to throw my macbook against the wall. This is my problem:
    Everytime i go on to the internet, in order for the internet to work i have to pull my ethernet cable out of the plug, plug it back in and refresh the page. The internet then works for about 4 pages on avg. and then it times out and says im not connected. In order to continue surfing on the net i have to pull the cable out and plug it back in. The wireless acts the same way. It will work and then times out. I have to turn off the airport and back on to get any internet.
    The browsers im using are Safari 3.1.2 and Firefox 3.0.1 and both act the same way. My roommate has a PC and has had no problems whatsoever. Our internet comes through the wall from a plug not from a router. I personally believe that it is my computer because i have tried getting internet from the plug in his room and the same thing happens. The wireless around my school comes from different towers and no matter where im at the same thing happens. I dont believe that its the internet. Ohh and one more piece of info. My first year at school my computer gave me NO internet problems whatsoever. I bought the computer brand new in June of 2007.
    If anyone knows how to fix this extremely annoying problem, please help me!! Thanks to all who answer~

    Hi
    I'm getting a problem which may be related, and i've figured out some workarounds (sort of inadequate ones but at least they're something).
    PROBLEM DESCRIPTION: almost immediately after installing the 10.5.5. system update, my MacBook started disconnecting itself from my wireless network. i'd be working online and suddenly i'd notice that only 3 bars of the AirPort icon on the menu bar would be showing and that the internet connection was no longer there. the only way to get the connection back would be to switch airport off and then back on and it would connect again. a couple of minutes later the connection would be gone again. infuriating stuff! i checked the system log using the Apple System Profiler (from the Apple menu) and found some messages about there being too many state changes detected on the AirPort network interface and that measures were being taken to fix stuff. it's a pity i didn't save the original error message since i no longer get it, but here's one I found that's identical reported by someone else:
    May 25 16:50:57 phoebe mDNSResponder[22]: Note: Frequent transitions for interface en1
    (FE80:0000:0000:0000:021E:C2FF:FEB9:8B73); network traffic reduction measures in effect
    anyway, the "measures" seemed to be to simply disconnect me from the net, which wasn't great. now the forums mentioned various solutions, but none of them actually worked.
    SOLUTION/WORKAROUND: two things seem to have made a difference. 1. i downloaded the combo 10.5.5. system updater and reinstalled it. somehow after i did this the problem would no longer happen (at least those errors would no longer occur). 2. keeping my ipod touch wireless interface switched off, because whenever my touch comes online within a minute or two the iBook disconnects from the net.
    COMMENTS: (1) even now if i connect to the wireless network with my iPod, my MacBook's connection will drop - so my solution is to not connect to the wireless network with my iPod touch, which ***** because i like to read stuff in bed on the touch sometimes. (2) reinstalling the system update (the combo version) definitely helped, because before i kept getting that error message in the system log, and even if the iPod touch was switched off the MacBook would still disconnect. (3) this suggest that there were two separate problems, one to do with a corrupted AirPort driver or something of that sort (which was fixed when I reinstalled the system update), and another to do with being kicked off when the iPod touch connects to the wireless network (this problem remains).
    I've replace my Linksys wireless router with a Netgear wireless router, but that's made no difference, so i'm pretty sure that the problem has to do with the MacBook - either the hardware or the software. I plan to get another hard disk soon at which point i'll do a clear reinstall of the OS, and if the problem persists then i'll know that it's a MacBook hardware problem. =(
    i'll post again here in the future, but if anyone has comments or suggestions or reports of this kind of problem then your input would be highly appreciated.
    thanx
    dr.colekat

  • 3 Apps stuck on loading .... HELP ME PLZ!!!!! THIS IS DRIVING ME CRAZY!!!

    So I was updating my app's yesterday and now I have 3 app windows that randomly appear on my iphone
    They do not have the name of the app below them .. it just says LOADING below the app square
    You can not delete them because they do not have a X above them when you try.
    This also drains my battery very quickly because it seems the phone is repeatedly trying to download something
    My app window keeps opening asking me to put in my password even though I am doing nothing APP related =(
    So I did a system restore .... didn't help
    reset the Iphone .... didn't help
    I used I-tunes to back up and restore ... deleted the apps on I-tunes
    tried every "trick" that was on any forums
    Nothing works!
    Someone Please Help me!!!!!
    I love love love my i-phone ... it probably is the best device I have ever purchased but small things like this drive me crazy

    first, remember how much you cherish that lil lovely device always. Don't "APP BROWSE" to pass the time. IT'S NOT A GAME! ;P
    second, It's BEST TO PROVIDE INFO. ON SPECS OF WHAT UR WORKING WITH. IE-iphone3G3Gs???/current iphone OS.update.ver.release(at time of device malfunction)/iTUNES.ver/complete app list(including ver. info. and......so on.
    NEhow, stop attempting to pull ?"tricks"?, as of right now. I THINK B-UP UR IPHONE (afterwards) was a bad idea. If by chance, you havn't done this, DON'T! Unplug usb data sync cable from iTunes. Delete all b-up/restore files up to last known "good" working backup.
    I HOPE YOU HAVE A 3G MODEL and/or APPLECARE. Go straight to an Apple store and swap for an AppleCare warranty replacement. If you're fortunate to get a "DO-OVER", consider your next steps carefully!! Until, you provide all the specs.(YES,every spec. listed above) unable to cont. --WAITING FOR REPLY

Maybe you are looking for

  • Anybody experienced loss of data when switching service providers?

    I recently transferred my two IMAP accounts to a new hosting service, but since I used the same names for the new accounts in Mail, all the mailboxes under the previous accounts, with hundreds of messages dating back to over two years, were deleted o

  • Itunes credit card ban

    I have been using the came credit card with iTunes for 3-4 years. All of a sudden I was being asked to verify the payment method.  I thought it was because I got a new iPhone5 this weekend and it needed the verification because the account was being

  • Increasing canvas size and re-clipping (intentionally)

    Hi, So I bolluxed up a little bit while creating my first full-bleed print piece. I used Ps to edit the image, Ai to add some stuff, and ignored Id completely for the printer. Now I have a perfect 8.5 x 11 image that I want to print all the way to th

  • Left click not responding

    Hi, I'm new to this community... and I'm desperate to find out the solution to my problem. My magic mouse and sometimes the trackpad on MacBook Pro dosn't work occationally.  Noticed usually when it's stated up or woke from sleep mode. It's strange t

  • CS5 Flash and Photoshop painfully slow

    I recently moved from CS4 Master Suite to CS5 Master Suite. I work with all files on a home based network drive. The CS4 handled most all tasks easily. The CS5 is painfully slow. Publish Previewing a very small Flash file with no action script and 3