Simple left-join doesn't work. error with: Unknown column

Hi guys,
can anyone assist on this simple query:
SELECT D.* , SUM( TD.debit_amount), SUM(TAP.amount)
FROM debit AS D, transaction_debit AS TD
LEFT JOIN TA_PAYMENTS AS TAP ON D.debit_id=TAP.debit_id
WHERE D.debit_id = TD.debit_id
GROUP BY TD.debit_idThe error message I receive is:
#1054 - Unknown column 'D.debit_id' in 'on clause' I'm trying to relate 3 tables (debit, transactions-debit and ta_payment), some payment may not exist so therefore i use left join.
thanks for any pointers

SELECT D.* , SUM( TD.debit_amount), SUM(TAP.amount)
FROM debit AS D, transaction_debit AS TD
LEFT JOIN TA_PAYMENTS AS TAP ON
D.debit_id=TAP.debit_id
WHERE D.debit_id = TD.debit_id
GROUP BY TD.debit_id
I'm trying to relate 3 tables (debit,
transactions-debit and ta_payment), some payment may
not exist so therefore i use left join.You are trying to mix "the older join syntax", with the join condition in the where-clause, with "the new join syntax", with the join condition in the "on-clause", which I think is causing trouble.
How about using only "the new syntax":
SELECT D.* , SUM( TD.debit_amount), SUM(TAP.amount)
FROM debit AS D JOIN transaction_debit AS TD on (D.debit_id = TD.debit_id)
     LEFT JOIN TA_PAYMENTS AS TAP ON (D.debit_id=TAP.debit_id)
GROUP BY TD.debit_idDoes that help?

Similar Messages

  • LEFT JOIN not exactly working

    Hi all,
    Hoping you can help me with my SQL query. I want to do a
    simple LEFT JOIN between two tables...fair enough right? Yeah,
    well, it works and all rows are returned from the LEFT table even
    if there are nmo matching rows in the RIGHT table.
    BUT, when I apply a few conditions using WHERE after this
    LEFT JOIN the whole point of the LEFT JOIN seems to not work. I
    only get rows from the LEFT where they match in the RIGHT.
    For example...this following code works and returns all LEFT
    rows despite there not being a match in the RIGHT.
    <cfquery name="getSchemaFields" datasource="#request.dsn#"
    username="#request.username#" password="#request.password#">
    SELECT schema_#getSchemas.schema_token#_fields.*,
    fields_content.*
    FROM schema_#getSchemas.schema_token#_fields
    LEFT JOIN fields_content
    ON schema_#getSchemas.schema_token#_fields.field_type_uuid =
    fields_content.field_content_field_uuid
    </cfquery>
    But, what I really need is to apply some conditions on the
    rows I want from the right table based on an ID like as follows...
    <cfquery name="getSchemaFields" datasource="#request.dsn#"
    username="#request.username#" password="#request.password#">
    SELECT schema_#getSchemas.schema_token#_fields.*,
    fields_content.*
    FROM schema_#getSchemas.schema_token#_fields
    LEFT JOIN fields_content
    ON schema_#getSchemas.schema_token#_fields.field_type_uuid =
    fields_content.field_content_field_uuid
    WHERE fields_content.field_content_item_id = <cfqueryparam
    cfsqltype="cf_sql_integer" value="#getSchemas.item_id#" />
    OR fields_content.field_content_item_id = NULL
    AND fields_content.field_content_item_uuid = <cfqueryparam
    cfsqltype="cf_sql_varchar" value="#getSchemas.item_uuid#" />
    OR fields_content.field_content_item_uuid = NULL
    </cfquery>
    Now I don't get any errors but what I do get is rows from the
    left ONLY when they match rows in the RIGHT. I still need all the
    rows from the LEFT despite this. The WHERE conditions seems to stop
    this happening.
    I know it's probably blindingly simple but I just can't get
    my head around it and I'm pulling my hair out about it!
    Hope somebody can assist me in this.
    Many thanks in advance!!
    Mikey.

    > Now I don't get any errors but what I do get is rows
    from the left ONLY when
    > they match rows in the RIGHT. I still need all the rows
    from the LEFT despite
    > this. The WHERE conditions seems to stop this happening.
    You need to stop to think about how the query is being
    executed.
    FIRST the FROM recordset is created which is the result of
    the join
    statement. This will have all your "left" rows, and null-data
    for
    unmatched "right" rows.
    THEN the WHERE clause is executed, which will filter out any
    rows from the
    recordset create in the FROM recordset.
    So if yuor data is this:
    TBL_FRUIT
    FRT_ID, FRT_NAME
    1, Apple
    2, Banana
    3, Cherry
    TBL_STOCK (<sung>we have no bananas, we have no bananas
    today</sung>)
    STK_ID, FRT_ID, STK_LEVEL
    1, 1, 12
    2, 3, 100
    And if you FROM clause is this:
    from TBL_FRUIT F left outer join TBL_STOCK S on F.FRT_ID =
    S.FRT_ID
    You get a record set thus:
    1, Apple, 12
    2, Banana, null
    3, Cherry, 100
    Now if you have a WHERE filter, thus:
    WHERE S.STK_LVEL > 0
    You're going tobe filtering out the banana row, because it
    DOESN'T have a
    STK_LEVEL > 0
    1, Apple, 12
    3, Cherry, 100
    You need to get all your filtering done on the STOCK table
    *before*
    left-joining it to the FRUIT table, if you want to have all
    the fruit rows
    in the final result.
    Dan's detailed how to effect this.
    Make sense?
    Adam

  • My iPod's headphone jack isn't working anymore, when i put my headphones in , the left l, My iPod's headphone jack isn't working anymore, when i put my headphones in , the left earphone doesn't work. Does anyone know if this can be fixed ?

    My iPod nano 3rd generation headphone jack isn't working anymore, when i put my headphones in , the left earphone doesn't work. Does anyone know if this can be fixed ?

    Hi Mr.Acevedo329!
    I have an article here for you that can help you troubleshoot the issues you are experiencing. That article can be found right here:
    iPod troubleshooting basics and service FAQ
    http://support.apple.com/kb/ts1382
    Specifically, you will want to take note of this section:
    The headphones don't work
    If your iPod's headphones don't work or have static or garbled audio, try connecting them to any other 3.5 mm stereo headphone jack, like the one on your computer. If the issue with the headphones persists, replace them. For an iPod under warranty, you can order a replacement online. Otherwise, check out the cool headphones at the Apple Online Store. If the issue appears to be with the iPod, try resetting it. If that doesn't work, then restore iPod with the latest iPod software using iTunes 7 or later.
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • Left Click doesn't work in Hotmail or Yahoo

    I was running low on disk space and my IT dept said they deleted some "temporary files". Whatever they did hosed IE so that it reverted from v8 to v7. They redid the IE upgrade and installed a bunch of updates from MS and upgraded Java, but I'm still having a problem in FF. Most sites are fine, but when I go to Yahoo or Hotmail email, left click doesn't work. I've tried uninstalling/reinstalling FF. I've tried running FF in safe mode and reinstalling some of the plugins that I thought might possibly have an effect. I still can't get it to work. I've used some of the web dev tools in FF, all I can find out is some of the errors that are reported on page load. On Hotmail, one is that a var called "JQuery" is undefined, among others.

    Clear the cache and the cookies from sites that cause problems.
    "Clear the Cache":
    *Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • Satellite Pro L20 doesn't work properly with USB Fast Track audio i.f.

    Hello!
    I have used my Fast Track USB on new Toshiba Satellite L40 and I never had problems with it. I could set low latency and I did few songs with it.
    Yesterday I bought another notebook, thinking of home recording studio. It's used Toshiba Satellite Pro L20. It doesn't work properly with my interface. When I listen music on Winamp or do anything on Fruity Loops I hear loud clicks, pops, noises. They introduce samples, or they appear during playback or after a sample is stopped.
    I noticed, drivers for Satellite Pro L20 are a problem. Its not supported by Toshiba anymore?! The only drivers for chipset are very old and you can download em only from Toshiba website. The chipset is ATI Xpress 200M. Its drivers are with graphic card. Recently I noticed you can download "ATI Catalyst Legacy Display Driver for Windows XP - Motherboard/IGP Drivers 9.11" and CRACK IT to make it possible to install on mobile unit such as L20. Yep its funny but its impossible to do otherwise!
    things I have tried and they still not help:
    # drivers replacement, original were released in 2004. I installed recent version.
    # driver settings, low latency, high latency
    # asio and different settings
    # pluging the interface to another usb socket.
    # trying what happens when I use battery and when I use adapter
    # updated bios
    # turned off onboard units such as wifi card, sound card
    # checked IRQ list
    pops still appear.
    my config:
    Toshiba Satellite Pro L20
    Win XP Home SP3
    Celeron M 1,5GHz
    896Mb ram
    M-Audio Fast Track USB, drivers: 6.0.2
    Kind regards

    Thanks for answer. I still have L40 but I try to run my homerecording on L20. The L40 is now used by whole my family. It's possible to swap them but there's a problem - L20 has Norway keyboard and I'm the only person at home who doesn't often look down while typing. In Poland, we use standard ms keyboard. I'd buy special stickers, it's about only to make special chars get back to their places.
    I installed Windows on this computer end set it to best performance possible.
    Since I created this thread, guys from M-Audio support tried to solve my problem - nothing helped. I think potential solutions are exhausted.
    Message was edited by: lidia.pochron

  • IPhoto doesn`t work correctly with german "umlaut" (ä,ö,ü) in keywords

    iPhoto doesn`t work correctly with german "umlaut" (ä,ö,ü) in keywords. They get to ä̈,ö̈, ü̈ when I write the keyword a second time. Can anybody tell me why. Thank you. Heinz

    It apparently does not like non-standard English characters - use A-Z and 0-9 adn you should be OK
    report to Apple - iPhoto menu ==> provide iPhoto feedback
    LN

  • Firefox from version 3.6 to 11 beta doesn't work properly with gmail

    Gmail doesn't work properly with any version of firefox from 3.6 to 11. I have tried several newer versions of firefox and they ALL DO NOT WORK PROPERLY with GMAIL!!!!!! THIS IS VERY FRUSTRATING & ANNOYING!! I can't click on any links or it just keeps saying LOADING when I try to delete a message or even go into the gmail settings.

    Try the Firefox SafeMode to see how it works there. <br />
    ''A troubleshooting mode, which disables most Add-ons.'' <br />
    ''(If you're not using it, switch to the Default Theme.)''
    * You can open the Firefox 4.0+ SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
    * Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
    ''Don't select anything right now, just use "Continue in SafeMode."''
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
    '''''If it is good in the Firefox SafeMode''''', your problem is probably caused by an extension, and you need to figure out which one. <br />
    http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes
    ''When you figure out what is causing that, please let us know. It might help other user's who have that problem.''

  • [svn] 4028: Bug: Draining of buffered messages doesn' t work correctly with long-polling.

    Revision: 4028
    Author: [email protected]
    Date: 2008-11-06 09:04:26 -0800 (Thu, 06 Nov 2008)
    Log Message:
    Bug: Draining of buffered messages doesn't work correctly with long-polling.
    QA: Yes - please make sure both nio and regular long-polling channels work with throttling.
    Doc: No
    Checkintests: Pass.
    Details: Made sure that buffered messages are drained properly with all polling channels (polling, long-polling, and nio-long-polling).
    Modified Paths:
    blazeds/trunk/modules/core/src/flex/messaging/client/FlexClient.java

    Sounds like you've probably already looked but the CUPS article in the wiki led me through setting up a printer without any problems.  http://wiki.archlinux.org/index.php/CUPS
    The first section describes how to troubleshoot CUPS and printing problems.
    I've also found a few other posts and links that may help.
    http://hplipopensource.com/hplip-web/mo … eries.html
    http://ubuntuforums.org/showthread.php?t=419163
    Hope this helps!

  • Some of my application in macbook pro doesn't work properly with Os Yosemite, such as dictionary and  MplayerX and etc

    I face to this problem since new OS, Yosemite has installed on my mac book
    some of my application in macbook pro doesn't work properly with Os Yosemite, such as dictionary (mac dictionary) and  MplayerX and etc
    For example when I make MplayerX and such application fullscreen the screen become white and just voice of video can be heard  or when I use Mac Dictionary (look-up dictionary) in any pages the meaning of work is not appear ( look at the picture above), so i need to directly open dictionary to find the meaning.
    Please help me
    tq

    Same thing here with MPlayerX (annoying)

  • Google News doesn't work properly with Safari 5.1.4

    Has anyone else noticed that Google News doesn't work properly with Safari 5.1.4?

    Thank you for your response.  The more I use 5.1.4 the more problems I am seeing.  There are problems with images and layout.  I would like to back up to 5.1.3 but the system won't let me. At present I a looking for a solution, or I might just start using Firefox.

  • Having issues with a left join, getting ORA-00904 error

    Ok this is something very similar to what I am facing, but dumbed down. None of these columns or tables names exist in real life (Very paranoid company I work for, understandable though) but the fundamental problem I am having is like below.
    Basically I know I could have done something similar to this is MS SQL (Or am I dreaming?). If I am right or wrong I need to know a way around this.
    Obviously if you comment out the "CAL.WEEK_SINCE_2005" and "AND CUST.week_since_2005 = CAL.WEEK_SINCE_2005" it would work. But I really need it to display the date as well. So it can be group'ed by week since 2005.
    I will be joining other statements to this. I am hoping on doing this in one select statement instead of creating multiple tables as I am now. All the other joined tables will follow a VERY similar layout to this. So something like this is need to obtain the look.
    When ran I get the following error.
    I look forward to learning what I did wrong and how I can fix it. :)
    select ORG.ORGANIZATION_NAME,
    CUST.CUST_COUNT,
    CAL.WEEK_SINCE_2005
    FROM organization ORG,
    calendar CAL
    LEFT JOIN (
    SELECT CAP.CURRENT_STORE,
    CALEN.week_since_2005,
    count(CAP.inactive_date) CUST_COUNT
    FROM CUST_AGREE_PAST CAP,
    calendar CALEN
    WHERE CAP.active_date is not null
    and CAP.inactive_code in ('T')
    and CAP.inactive_date between '01-sep-07' and sysdate
    and CAP.INACTIVE_DATE = CALEN.CALENDAR_DATE
    and CAP.RSN_CODE_ID in (select rsn_code_id from reasons where title in ('FAIL', 'NO CALL'))
    GROUP BY CAP.CURRENT_STORE,
    CALEN.week_since_2005) CUST
    ON PO.CURRENT_STORE = ORG.ORGANIZATION_NAME
    AND CUST.week_since_2005 = CAL.WEEK_SINCE_2005

    Just noticed a problem (there might be others):
    FROM organization ORG,
    calendar CAL
    LEFT JOIN (You cannot do that - you are mixing Oracle and ANSI join syntax. You have to do one or the other:
    FROM organization ORG
    JOIN calendar CAL on (ORG.col = CAL.col)
    LEFT JOIN (....)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Save As... Duplicate lvproj file doesn't work correctly with lvlibs/lvclasses

    I am trying to save a copy of a project with all dependencies so that I can sent a subset of our code to NI technical support for another issue. I have been unable to do this successfully and have isolated this to limitations of "Save As..." --> "Duplicate .lvproj file and contents (Include all dependencies)" when handling lvlibs and lvclasses. I am wondering if I am doing something wrong or if there is a workaround. 
    I am using LabView 8.6.1 under Windows. A sample project displaying this issue is attached. To repro the problem I am having,
    Open library.lvproj. This is simple project with one library (SimpleLibrary.lvlib) and two VIs that are member of that library. (Add.vi and Subtract.vi).
    File -> Save As... -> Duplicate .lvproj file and contents (Include all dependencies)
    Pick a new location in your filesystem somewhere.
    The save starts, then LabView puts up a dialog box "Cannot save library 'SimpleLibrary.lvlib'. Another library in memory is already loaded from that path." (Note that this is not true; the library is loaded from the original project path; nothing has as of yet been saved to the new project path.)
    LabView it gives you a file dialog in the target location. If you click OK (opting to save it to the new location in the same relative path as in the original project), it returns to the "Cannot save library" dialog box. If you create a new folder (i.e. "New Folder") in the target and descend into the target, then the save is allowed, but when you re-open the project it looks for the library at the old location (relative to the new copy of the project), and it opens it as conflicted. The conflicts must be resolved manually. 
    The manual move-and-unconflict process is tolerable with a simple project containing one library, but it is impractical in a large project with dozens of lvlibs and classes.
    Can anyone suggest a workaround for this behavior so that a project can be exported with all of its dependencies and without path corruption? 
    Thanks,
    Rob 
    Message Edited by Rob Calhoun on 08-24-2009 03:10 PM
    Attachments:
    libraryproject.zip ‏9 KB
    cant-save-lvlib.png ‏7 KB

    I loved Ben's suggestion because it promised to be a low-effort workaround, but, alas, I get the same problem: "lvlib is already loaded from this path...".
    I tried Olivia's workaround for CAR 124214. It worked great for the simple lvproj that is posted above. (Hooray!) It didn't work so well in my real project, that has about 30 lvlibs and lvclasses. About 3/4 of the way through the save, I got a compiler error and LabView crashed. (Boo!) I submitted the crash log on this, but it's hard to imagine how anyone in R&D could make any progress debugging this without the source code. (And I can't submit the source because I can't export a copy of it!)
    Anyway, thank you very much Ben and Olivia for your suggestions. I have lvclasses embedded in lvlibs (primarily for organizational reasons) and since LabView tanked while saving one of those, perhaps the workaround doesn't work in this case. I may try again after removing the lvclasses from the lvlibs so that the hierarchy is flatter.
    -Rob 

  • AirPrint doesn't work anymore with iOS 8

    wwith iOS 8 update, AirPrint doesnt work anymore with HP printer.  Lenova pc works fine.   Any ideas what to do?

    Hello there, Bkurowski818.
    The following Knowledge Base article offers up some great recommendations for troubleshooting AirPrint issues:
    About AirPrint - Apple Support
    For best results
    Make sure your software is up to date. For iOS, verify that your device is using the latest version of iOS available and that the app you're printing from is up to date. For OS X, Use Software Update to update OS X and apps you've purchased from the Mac App Store.
    AirPrint printers connected to the USB port of an Apple AirPort Base Station or AirPort Time Capsule are not supported with AirPrint. Connect your AirPrint printer to your network using Wi-Fi, or connect it to a LAN port on your AirPort device using Ethernet.
    Make sure that your AirPrint printer is connected to your network before attempting to print. Some AirPrint printers can take several minutes to join a network after being turned on.
    If you're unable to print
    Check these things if you are unable to print, or if you see the message "No AirPrint Printers Found."
    Make sure your printer has paper, and enough ink or toner installed.
    Make sure your printer is connected to the same Wi-Fi network as your iOS device.
    Make sure your printer has power and is turned on. Try turning your printer off and then back on again to see if it resolves your issue.
    Check to see if your printer has any error lights or indicators displayed on the printer's control panel. Check the documentation that came with your printer to clear any errors displayed.
    Check with your printer's manufacturer to see if any firmware updates are available for your printer. Check your printer's documentation or contact the printer vendor for more information. A firmware update may be available, even if you just bought your printer.
    The information below is provided by each manufacturer and is updated once a month by Apple. You can use the Find feature of your web browser (usually Command-F) to search for a specific device in this list. If you don't see your printer or server listed, check with the printer manufacturer for more information.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Rear left speaker doesn't work on X-FI XtremeMu

    So I bought this X-Fi xtrememusic..No doubt it works fantastically in gaming and pinpoints the source of sound really well..Well what's my problem? this POS X-Fi doesn't emit any sound from rear left speaker..my speaker isn't the issue here because I tried it with my $0 sound card and rear left speaker works FINE..how the hell $30 worth sound card can't do/perform something that even $0 sound card can do...give me a break Creative...this **bleep** is going back to the store if there is no solution to this.. I've already wasted 2 hrs of my life just trying to reinstall/uninstall newer/older version of their bloated drivers..no avail..What should I do? I'd like to keep this card as it is the best gaming sound card out there right now....
    Any one?
    Sorry for some mild profanity.. I just had to take my anger out somewhere..
    System spec:
    Athlon 64 x2 3800+ / DFI NF4 ULTRA-D / ATI X800XT / X-FI XTREMEMUSIC/ GB PC 3200 DDR / Gigaworks S700/ Antec NeoPower 480Watt/
    Message Edited by netddos on -25-2005 07:47 AM

    This is getting me pissed now. I have the Fitalty version and everything working fine at first, except for the stuttering in HF2, but now in Game mode only my Front right speaker doesn't work. I do have all the latest drivers on my system and Creative. I only lose my right front speaker in game mode, I swap to entertainment and everything works fine.
    I agree with the above poster that its a driver issue, I do know creative has always lacked in that dept (decent drivers) so I have no reason to believe otherwise now.
    I've tried alot of various things and sorry for not listing them all, nothing has worked yet.

  • Javafx webview doesn't work properly with google keywords tool

    Hi,
    I am trying to load https://adwords.google.com/o/KeywordTool in a javafx webview but I keep getting the following error:
    There was an error with your operation. If you were trying to make a change, it may not have saved. Please refresh this page to try again. If the error continues, log out of your AdWords account, then log in again and return to this page.
    The issue is not consistent - once every 10 tries it works. I read in another forum that the issue could be due to missing sunjce_provider.jar but it persists even if I add sunjce_provider.jar to the libraries in my Netbeans project.
    The test is as follows:
    public class TestBrowser extends Application {
    @Override
    public void start(Stage stage) throws IOException {
    StackPane root = new StackPane();
    WebView view = new WebView();
    WebEngine engine = view.getEngine();
    String uri = "https://adwords.google.com/o/KeywordTool";
    engine.load(uri);
    root.getChildren().add(view);
    Scene scene = new Scene(root, 800, 600);
    stage.setScene(scene);
    stage.show();
    public static void main(String[] args) {
    launch(args);
    Am I doing something wrong ? or missing something ?
    Thanks.

    Thanks for the reply.
    I don't think the problem is with webkit, qwebview from Qt4 works fine for the same site. I used the flag -Djavax.net.debug=all, but it didn't print any debug messages in the console ? I added -Djavax.net.debug=all to command line parameters in the Run dialog of my Netbeans project. Is that the right way to do it ?

Maybe you are looking for

  • Document numbering in SAP B1 2005 B

    Hi I have defined two series for each document type and alloted them to different user like A and B (both A & B are not super user). When i am logging in SAP B1 as A or B and trying to make a document. SYSTEM is showing that "You need to define the D

  • Menu changes automatically

    Hello everybody Let me sketch my situation: I have bought a precomposed menu which I have used a half year without any problems. I load the preset, and change colors of the menu in Photoshop. Once saved there it changes automatically in Encore. When

  • Native Library ocijdbc8.dll already loaded in another classloader

    Hi, help me please! I have Platform: Win2000/Orion/JSP + Oracle 8.1.7 and while using this testdb.jsp file (simple select from some table and print result) i get error: java.lang.UnsatisfiedLinkError: Native Library C:\oracle\ora81\bin\ocijdbc8.dll a

  • AE Output Module "ignores" Audio Output

    Hi! I have created an output module as seen below. The "Audio Output" box is checked. Almost everytime I render a file there's no audio in the rendered video.... When I put the comp into the render queue, go to the output module setting, uncheck the

  • Batch is not copying while backflush,Using Spilt Valuation & Batch

    Dear Sir, While backflushing the BOM batch is not gets copyed in MFBF. User want to desplay all the batches which are going to Consume for the perticular material.so that he will control the price of component. Thanks in Advance....