mysql - Why can't "SELECT DISTINCT 1 AS score ORDER BY score DESC;" work during creation of temporary table -


In MySQL, this part of the code works and produces a line of '1' as the value.

  Select DISTINCT score by score 1 score;  

However, when I use it with the formation of temporal tables as one below:

  DROP TABPARY TABLE If 'testTable' exists ; Construct a temporary table Select 'Testlet'; DESC based on 1 score score;  

MySQL says: There is an error in your SQL syntax;

Note that the code below works ... without any sequence

> drop temp table if present is 'test table'; Select the temporary table 'test table' Select the difference 1 AS score;

According to the below shown, one has to be added to the FROM block, this will work ...

  drop template table if exists 'testTable'; Create temporary table Select `Test Table '1 score score by DESC by Tx order;  

I know that my sample above is not important, but it is a question of curiosity. Thank you.

Selection-description is fully valid, so it should work, but maybe MySQL is a little bit Pickup or buggy about this statement

You are probably missing the data type of the column where the data is to be stored. Adding a column name to the datatype it works.

Select the temporary table testTable (INTEGER score) 1 AS score;

Do not specify the data format In this case, to make a statement, it can be estimated that this is a small, small, integer ... If you select from a table, then the datatype is the table Is defined in


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -