本文介绍了亚音速查询(ConditionA或ConditionB)和ConditionC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何构建这种格式的亚音速查询



Iv tried various approaches but I cant seem to get the desired result.

Here is one thing i tired:

Query q = Challenge.CreateQuery();
      q.WHERE(Challenge.Columns.ChallengeeKey, playerKey)
      .OR(Challenge.Columns.ChallengerKey, playerKey);
       q.AND(Challenge.Columns.Complete, false);
解决方案

I'm using Subsonic 2.2, I tried a few variations on Rob's example but kept getting an exception with the message: "Need to have at least one From table specified"

In the end this achieved the desired result:

          Challenge challenge = new Select().From(Challenge.Schema)
           .WhereExpression(Challenge.Columns.ChallengerKey).IsEqualTo(playerKey)
           .Or(Challenge.Columns.ChallengerKey).IsGreaterThan(playerKey)
           .AndExpression(Challenge.Columns.Complete).IsEqualTo(false)
           .ExecuteSingle<Challenge>();

这篇关于亚音速查询(ConditionA或ConditionB)和ConditionC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 03:03