Azure表存储-列上的where子句可能不存在
我要在我的azure表中添加一个新列.例如,该表称为用户",新列称为"ComputationDate". 用户"表已经存在,其中的行没有此新列"ComputationDate".我对其有如下查询,
I am adding a new column to my azure table. For ex., the table is called 'User' and the new column is called 'ComputationDate'. The 'User' table already exists with rows that do not have this new column 'ComputationDate'. I have a query over it as follows,
var usersDue = from user in Table.Query
where user.ComputationDate != <somedate>
select user;
var usersDue = from user in Table.Query
where user.ComputationDate != <somedate>
select user;
我希望此查询返回未将ComputationDate设置为"somedate"的所有用户行,以及未定义此新的"ComputationDate"列的用户行. 但是查询不会返回后一组用户.它仅返回设置了"ComputationDate"且值不等于"somedate"的行. 有什么方法可以得到我想要的结果,而不必让所有用户都在客户端上对其进行过滤?
I want this query to return all user rows that do not have ComputationDate set to 'somedate' and also user rows that do not have this new 'ComputationDate' column defined. But the query doesn't return the latter set of users. It only returns rows that have 'ComputationDate' set and where the value is not equal to 'somedate'. Is there any way to get the results I desire without having to get all users and filter it on the client?
您似乎正在尝试执行LINQ to SQL查询.
It looks like you're trying to do a LINQ to SQL query.
这可能会更好地满足您的需求:
This may serve your needs better:
var usersDue = from user in Table.Query
where user.ComputationDate != <somedate>
|| user.ComputationDate == null
select user;