English 中文(简体)
在条款中添加“准则”
原标题:Add where clause, LINQ

我有:

 var x = from os in dbLinq.vmesne_ures
         where ((os._projekt_id).Equals(_cb_projekt_id))
         orderby os.projekt_name
         group new { vm_oseba_id = os._oseba_id } by os._oseba_id into uniqueIds
         select uniqueIds.FirstOrDefault();

它回收了独一无二的胎。 可在<>处添加<代码>。 <条码>x? 类似于

 var y = x ... where os._oseba_id < 100

我知道,在什么地方可以做到:(os._projekt_id).Equals(_cb_projekt_id) &&在什么地方,_oseba_id < 100)或类似。 如果能够在<条码>x上添加另一个<条码>的<条码>,则寻找这一解决办法?

最佳回答

您可以添加另一条条款:

var x = from os in dbLinq.vmesne_ures
         where ((os._projekt_id).Equals(_cb_projekt_id))
         where os._oseba_id < 100
         orderby os.projekt_name
         group new { vm_oseba_id = os._oseba_id } by os._oseba_id into uniqueIds
         select uniqueIds.FirstOrDefault();

两个地点与“和”及“&”之间唯一的差别;操作者是,设立了两名代表,但算法仍然是O(n)。

问题回答

暂无回答




相关问题
using the where clause + new constraint with args?

I have a piece of code that looks like this: public static T CreateSomething<T>(SomeType a) where T : SomeMicrosoftBaseClass, new() { var newElement = new T { SomeProperty = a}; ...

Strange .Where() behaviour. Somebody has an explanation?

Original I don t get why the Where() clause doesn t give me the right results in the last example. It isn t any different is it? Why does C# behaves differently? transactions = IEnumerable<...

Linq To Sql Where Or operator

I need to create a query which checks if a field (string) contains one or more words supplied at run time. Basically I need to be able to ask a WhereOr question. This seems like it should be a ...

C# Beginner: Where has my IList.Where() method gone?

I ve got another simple one (I think) that s stumping me. I have written a method in one of my controls that gets the latest version of a file in a CMS given it s filename (i.e. regardless of what ...

sql simple query

Yesterday my friend asked me a question about this query: select * from user where 1=1 I said that the query is incorrect, but he said it s correct. I don t understand how this query can be correct....

Codeigniter WHERE on "AS" field

I have a query where I need to modify the selected data and I want to limit my results of that data. For instance: SELECT table_id, radians( 25 ) AS rad FROM test_table WHERE rad < 5 ORDER BY rad ...

SEARCH several Tables IN SQL

I m trying to search several tables at once for a search term. My query is: SELECT item.ItemID FROM Inventory.Item item JOIN Inventory.Category catR // each item can be in several ...

热门标签