hi, guys, help needed on generating such sql statement
hi, guys.
I'm just stucked on generating such sql statement. any help would be appriciated.
select * from a where (a.id =1 or a.name='hello') and a.age=18
I use the following
SqlQuery query = new Select().From(a);
query.Or("id").IsEquals(1);
query.Or("name").IsEquals('hello');
query.And("age").IsEquals(18);
and it generates the following sql statement:
select * from a where a.id =1 or a.name='hello' and a.age=18
see? I need a "()" to include or statement otherwise it would means completely different from what I wanted.
so my question is how to add a "( )" to wrap "or" statement up.
Thanks.
I'm just stucked on generating such sql statement. any help would be appriciated.
select * from a where (a.id =1 or a.name='hello') and a.age=18
I use the following
SqlQuery query = new Select().From(a);
query.Or("id").IsEquals(1);
query.Or("name").IsEquals('hello');
query.And("age").IsEquals(18);
and it generates the following sql statement:
select * from a where a.id =1 or a.name='hello' and a.age=18
see? I need a "()" to include or statement otherwise it would means completely different from what I wanted.
so my question is how to add a "( )" to wrap "or" statement up.
Thanks.