Create ODBC Dataset From Two Tables

When creating a new dataset, I am having trouble using any kind of join in the SQL.  I am using ODBC and want to create a dataset that, for example, combines Invoice Header and Invoice Detail information.  Do I need to create each of those as their own dataset and then do a transform, or can I do it all at once in one dataset?

Best Answer

  • user02986
    Accepted Answer

    It had to do with the ODBC driver we have.  The join had to be written this way:

     

    FROM { IJ SA_INVOICE_HEADER LEFT JOIN SA_INVOICE_LINE ON SA_INVOICE_HEADER.invoice_num = SA_INVOICE_LINE.invoice_num}

     

    The query works now but unfortunately, it takes forever to run.  It is a really old driver, but the newer version won't work with our ERP system, so the best solution seems to be just connecting the tables as is and then using ETL to do all the joins.  

Answers

  • Do that all in one dataset if you can, unless you'd have a reason to have these as individual datasets for separate use in Domo.

    Most of our Workbench ODBC queries have multiple table joins.  It's just passing the query to the server to process, so it should be able to use whatever logic you provide it.  For example, we have some custom function calls in our queries, and they pass through and run just fine (for us that's on Oracle).    

  • I keep getting the following error.  The query runs just fine in Access, so I am not sure what the problem is.

     

    ERROR [37000] [ProvideX][ODBC Driver]Unexpected extra token: LEFT

     

    Here is my query:

    SELECT SA_INVOICE_HEADER.invoice_date, SA_INVOICE_HEADER.doc_num, SA_INVOICE_HEADER.invoice_num, SA_INVOICE_HEADER.ship_via, SA_INVOICE_HEADER.salesperson_terr, SA_INVOICE_HEADER.cust_num, SA_INVOICE_LINE.ship_to_num, SA_INVOICE_LINE.item_num, SA_INVOICE_LINE.item_class, SA_INVOICE_LINE.gl_post_table, SA_INVOICE_LINE.um_selling, SA_INVOICE_LINE.amount_shipped
    FROM SA_INVOICE_HEADER LEFT JOIN SA_INVOICE_LINE ON SA_INVOICE_HEADER.invoice_num = SA_INVOICE_LINE.invoice_num

  • That looks just fine to me.  Does it change if you did LEFT OUTER JOIN instead?