0

I am trying to write a line of code in PHP, and this is probably a stupid question but I'm new to coding. I get this error when I try to run my php page:

"Error in query preparation/execution. Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 1013 [code] => 1013 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]The objects "ACTION" and "action" in the FROM clause have the same exposed names. Use correlation names to distinguish them. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]The objects "ACTION" and "action" in the FROM clause have the same exposed names. Use correlation names to distinguish them. ) )"

My question is simply how do I use a correlation name for the table name? I have a table called "action" and I am trying to write a statement that contains inner joins, so the database doesn't like that I'm trying to perform the INNER JOIN ACTION on my action table.. go figure!

I've tried to research it, but I keep finding complex examples of setting correlation names. Any help is greatly appreciated!

4

1 に答える 1

0

テーブルを使用するケースごとに一意のエイリアスを使用する必要がありactionます。クエリは表示されませんでしたが、次のようになります。

SELECT *
FROM   ACTION a1
INNER JOIN ACTION a2 ON ...

このようにして、同じテーブルの各インスタンスの使用目的がクエリ パーサーに明確になります。

于 2013-04-25T04:32:22.277 に答える