我有以下查询,为什么我不能让我的where子句工作?该值确实存在于表中。
Select B.*, B.[RF attribute1] & "|" & B.[RF attribute2] & "|" & B.[RF attribute3] & "|" & B.[RF attribute4] as new_field
FROM [Black$] as B
where new_field = "Stack|over||flow"
错误消息为No value given for one or more required paramters
修改,实际数据:
+---------------+---------------+---------------+---------------+
| RF attribute1 | RF attribute2 | RF attribute3 | RF attribute4 |
+---------------+---------------+---------------+---------------+
| BONDZERO | AUD | | MID |
| BONDZERO | AUD | | MID |
| SWAPZERO | AUD | | MID |
| SWAPZERO | AUD | | MID |
将创建一个新字段,如下所示:
+-------------------+
| new_field |
+-------------------+
| BONDZERO|AUD||MID |
| BONDZERO|AUD||MID |
| SWAPZERO|AUD||MID |
| SWAPZERO|AUD||MID |
+-------------------+
现在我正在尝试使用where子句BONDZERO|AUD||MID
,因此它只返回前两行。
答案 0 :(得分:1)
Access认为您尝试将new_field
作为参数传递。
您需要详细说明WHERE
条款:
Select B.*, B.[RF attribute1] & "|"
& B.[RF attribute2] & "|"
& B.[RF attribute3] & "|"
& B.[RF attribute4] as new_field
FROM [Black$] as B
where B.[RF attribute1] & "|"
& B.[RF attribute2] & "|"
& B.[RF attribute3] & "|"
& B.[RF attribute4] = "Stack|over||flow"
答案 1 :(得分:1)
使用子查询:
select b.*
from (Select B.*, B.[RF attribute1] & "|" & B.[RF attribute2] & "|" & B.[RF attribute3] & "|" & B.[RF attribute4] as new_field
from [Black$] as B
) as b
where new_field = "Stack|over||flow";