2 Replies Latest reply on Apr 15, 2013 11:14 PM by Joao Correia

    Tableau using tables which are not needed

    Joao Correia

      Hello Tableau users,

       

      I established a MySQL connection with ORDERS, USERS, ORDERLINES and INVENTORY.

       

      My goal is to know how many new users signup on a particular day. This is a pretty simple query that only should involve the USERS table.

       

      Tableau creates a query that joins tables that are irrelevant to what Im trying to know giving me other results.

       

      SELECT `USERS`.`username` AS `none_USERS_username_nk` FROM `ORDERS` INNER JOIN `ORDERLINES` ON (`ORDERS`.`order_id` = `ORDERLINES`.`order_id`) INNER JOIN `INVENTORY` ON (`ORDERLINES`.`SKU` = `INVENTORY`.`SKU`) INNER JOIN `USERS` ON (`ORDERS`.`username` = `USERS`.`username`) WHERE ((`USERS`.`registration_date` >= DATE_ADD(ADDDATE( DATE_FORMAT( TIMESTAMP('2013-04-08 20:52:07'), '%Y-%m-%d 00:00:00' ), INTERVAL 0 SECOND ), INTERVAL 0 DAY)) AND (`USERS`.`registration_date` < DATE_ADD(ADDDATE( DATE_FORMAT( TIMESTAMP('2013-04-08 20:52:07'), '%Y-%m-%d 00:00:00' ), INTERVAL 0 SECOND ), INTERVAL 1 DAY))) GROUP BY 1;

       

      A simple query like this produces the result I want:

       

      select registration_date,bill_country,username from USERS where registration_date like '2013-03-31%' order by registration_date desc;

       

      Thanks

      Joao Correia