Reputation: 580
How to use FilterRaw
with Filter
instead Raw()
This is my query
_, err := o.QueryTable("BillDetail").Filter("OriginalID", id).Filter("Date", xxx).Filter("Date", yyy).All(&bills)
I want to use filter like
rawSeter = o.Raw("SELECT bill_detail FROM WHERE original_i_d = ? AND WHERE date BETWEEN ? AND ?", id, xxx, yyy)
Because my QueryTable
works wrong. It doesn't take WHERE date =?
instead BETWEEN
.
And I tried this
_, err = o.QueryTable("BillDetail").Filter("OriginalID", id).FilterRaw("WHERE date BETWEEN ? AND ?", xxx, yyy).All(&bills)
But it give me this error
too many arguments in call to o.QueryTable("BillDetail").Filter("OriginalID", id).FilterRaw have (string, time.Time, time.Time) want (string, string)go
then how do I use properly.
Upvotes: 1
Views: 833
Reputation: 642
_, err := o.Raw("SELECT *FROM bill_detail where original_i_d = ? AND date BETWEEN ? and ?", id, xxx, yyy).QueryRows(&bills)
You can add just query like this.
Upvotes: 1