tags:

views:

68

answers:

1

Here is my code:

TransactionCollection transactions = new TransactionCollection();
transactions.Where("next_action", "RESEND");
transactions.Where("job_id", CurrentJob.Id);
transactions.Load();

I really want it to say next_action is RESEND or next_action is TARGET. Thanks.

Basically I want a select statemnt like this:

select * from transactions where job_id = 1 and (next_action = 'RESEND' OR next_action = 'TARGET');

or

select * from transactions where job_id = 1 and next_action IN ('RESEND', 'TARGET');
+2  A: 

If you're on SubSonic version 2.1 or above you can take advantage of the AndExpression and OrExpression. For your first example the following should work:

TransactionCollection transactions = DB.Select().From(Transaction.Schema)
  .Where("job_id", CurrentJob.Id);
  .AndExpression("next_action")IsEqualTo("RESEND")
  .Or("next_action")IsEqualTo("TARGET")
  .ExecuteCollection<TransactionCollection>()
Adam
Have a look at http://subsonicproject.com/querying/select-queries/ for more examples
Adam