Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

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

Open
CNBaiLH opened this issue Aug 20, 2019 · 1 comment
Open

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

CNBaiLH opened this issue Aug 20, 2019 · 1 comment
Labels

Comments

@CNBaiLH
Copy link

CNBaiLH commented Aug 20, 2019

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=?)

@lunny lunny added the question label Aug 20, 2019
@lunny
Copy link
Member

lunny commented Aug 20, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants