开发者

Access sql query Circular Reference error

开发者 https://www.devze.com 2022-12-27 14:08 出处:网络
I\'m creating a sql select query for an access database, and receiving a circular reference error, because my alias name is the same as a column name in my expression. Here i开发者_JAVA百科s the fragm

I'm creating a sql select query for an access database, and receiving a circular reference error, because my alias name is the same as a column name in my expression. Here i开发者_JAVA百科s the fragment of my query:

switch([CULET]='N','NONE', [CULET]='S', 'SMALL',[CULET]='VS','VERY SMALL', [CULET]='SL','  ',[CULET]='MD','  ') AS [Culet] 

This specific alias name is part of the requirements for the output. Is there any way to get around this without changing the alias name?

TIA


Add the table name/alias to the field. Something like

Switch([Table1.CULET]='N','NONE',[Table1.CULET]='S','SMALL',[Table1.CULET]='VS','VERY SMALL',[Table1.CULET]='SL','  ',[Table1.CULET]='MD','  ') AS Culet


Sometimes, this error can occur when the circular reference is actually within one of the queries used as the basis of the query you are working on (even when the basis query actually doesn't raise any errors, itself!) In this case, you should follow the recommendations in Microsoft's KB (knowledge-base) article 97526, for the basis query.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号