-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
希望egg-mysql支持在select字段列中写子查询 #5761
Copy link
Copy link
Open
Description
请详细告知你的新点子(Nice Ideas):
- 希望egg-mysql支持在select字段列中写子查询
如:
SELECT id, username, nickname, login_type,
(SELECT SUM(times) FROM remoter_device_use AS du
WHERE du.user_id = sys_user.id AND du.times > 0) AS use_times
FROM sys_user WHERE deleted = 0
ORDER BY use_times DESC, id DESC
LIMIT 0, 10我使用这种写法会出现sql错误(SELECT SUM(times) FROM remoter_device_use AS du WHERE du.user_id = sys_user.id AND times > 0) AS use_times不是字段
this.app.mysql.select('sys_user', {
columns: [
'id',
'username',
'nickname',
'login_type',
'(SELECT SUM(times) FROM remoter_device_use AS du WHERE du.user_id = sys_user.id AND times > 0) AS use_times'
],
where,
orders: [
[ 'use_times', 'DESC' ],
[ 'id', 'DESC' ]
],
limit: pageSize,
offset
});- 希望egg-mysql查询支持写and or条件混合。
egg-mysql的支持实在太弱了。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels