1 Reply Latest reply on Jan 5, 2017 6:01 AM by Christina Davis

    Using "Set" command in custom SQL query

    Matan Bracha

      Hi All!

       

      I have a custom query that I need to use in tableau.

      The query contains "SELECT (case campaign when 'Display' then 'Display Network' when 'Search' then 'Search Network' else 'YouTube Videos' end) campaign".

      Which generate the next error: "[MySQL][ODBC 5.3(w) Driver][mysqld-5.6.10-log]Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' "

      In the MySQL interface I run this query with "SET collation_connection = 'latin1_swedish_ci';" before - which fixes my roblem.

       

      But, I can't run two queries together in the "SQL Custom Query", and now I'm totally stuck.

      Does anyone has any idea how to make this query run? Every solution will be great!

       

      Thank a lot.

        • 1. Re: Using "Set" command in custom SQL query
          Christina Davis

          Hi Matan,

          I don't code in MySQL but I know that in MS SQL you can set the collation at the column level by doing:

           

          select Column1 COLLATE latin1_swedish_ci
          from table
          

           

          If MySQL allows this syntax then you can rewrite your script with these collation clauses on each column allowing you to write just one custom sql query for Tableau.

           

          Hope this helps!