Tag Info

New answers tagged

0

Jynus's answer is very good, but i would also add that in some cases more than one table in a query can have the same field name which is ambiguous and must be resolved. Although I guess you could use a full table name as a prefix. In my experience when dealing with extremely long table names that can have very similar spelling, using aliases makes the ...


8

In some cases, MySQL requires an alias, for example, a self join: mysql> CREATE TABLE test (id SERIAL, name text); Query OK, 0 rows affected (0.02 sec) mysql> SELECT name FROM test JOIN test on test.id=test.id; ERROR 1066 (42000): Not unique table/alias: 'test' mysql> SELECT T1.name FROM test T1 JOIN test T2 on T1.id=T2.id; Empty set (0.00 sec) ...


0

You can create a client alias on the application server. You will have to run CLICONFG.EXE on the client, click add on the alias tab, click TCP/IP add the server alias B and set the connection paramters to be FC\SQLSRV after this all connections to server B from that client/application server will be forwarded to FC\SQLSRV If your application is 32bit you ...


0

According to the last comment at the bug report (http://bugs.mysql.com/bug.php?id=76988), it's a bug present in 5.6.24 (current release at the time of writting), and it has been fixed in current source code. Thank you for the bug report. I was able to repeat with 5.6.24 version but not more with current source probably fixed for bug ...


0

You should run the query in this way. It will work correctly. SELECT a.* , if(u.status = 1 AND a.acre_aprobado = 0, 5, u.status) tipo FROM acreditado a JOIN users u ON (`a`.`acre_id` = `u`.`id`) WHERE `acre_test` = 0 GROUP BY `a`.`acre_id`,tipo HAVING tipo = '1' ORDER BY `a`.`acre_id`,`acre_aprobado` ASC This is depend on mysql server ...


2

The HAVING tipo = '1' should in no way allow output to include tipo=0, regardless of GROUP BY issues, etc. File a bug report at http://bugs.mysql.com .


1

I recently answered a post Does "deprecated" in MySQL means "not guaranteed" or "still guaranteed"? where I mentioned how ORDER BY NULL can have spurious behavior between Storage Engines and Major/Minor Versions (in your case). Your question shows that you are doing what the end of my post says Therefore, you should always ...



Top 50 recent answers are included