FindAndCount, 生成的count语句有问题? #1398

Closed
opened 2019-08-20 03:24:29 +00:00 by a7505553 · 1 comment
a7505553 commented 2019-08-20 03:24:29 +00:00 (Migrated from github.com)
SELECT  * FROM `orders` WHERE (merchant_id IN (?,?)) AND (`delete_at` IS NULL OR `deleted_at`=?) LIMIT 10 []interface {}{"1", "2", "0001-01-01 00:00:00"} 


SELECT count(*) FROM `orders` WHERE (merchant_id IN (?,?)) AND (`delete_at` IS NULL OR `deleted_at`=?) AND (`deleted_at` IS NULL OR `deleted_at`=?) []interface {}{"1", "2", "0001-01-01 00:00:00", "0001-01-01 00:00:00"} 

count语句多了一个 (deleted_at IS NULL OR deleted_at=?)

``` SELECT * FROM `orders` WHERE (merchant_id IN (?,?)) AND (`delete_at` IS NULL OR `deleted_at`=?) LIMIT 10 []interface {}{"1", "2", "0001-01-01 00:00:00"} SELECT count(*) FROM `orders` WHERE (merchant_id IN (?,?)) AND (`delete_at` IS NULL OR `deleted_at`=?) AND (`deleted_at` IS NULL OR `deleted_at`=?) []interface {}{"1", "2", "0001-01-01 00:00:00", "0001-01-01 00:00:00"} ``` count语句多了一个 (`deleted_at` IS NULL OR `deleted_at`=?)

If you have deleted column, the condition will be added automatically.

If you have `deleted` column, the condition will be added automatically.
lunny closed this issue 2020-03-23 12:35:28 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1398
No description provided.