- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有2张 table :
用户:
id name phone
__________________________________
1 Zusha 123a
2 Zelig 123b
3 Shmerel 123e
id userId fromPhone toPhone date
________________________________________________________
1 1 123a support 2020-03-01 19:15:29
2 1 support 123a 2020-03-01 20:35:08
3 2 123c support 2020-03-02 19:15:23
4 1 123a support 2020-03-03 19:15:56
5 3 123e support 2020-03-04 19:17:22
6 3 support 123e 2020-03-04 19:18:34
7 3 123e support 2020-03-04 19:19:24
8 4 support 123e 2020-03-04 19:25:42
id name phone preLastChatDate lastChatDate
_____________________________________________________________________________________
1 Zusha 123a 2020-03-01 19:15:29 2020-03-03 19:15:56
2 Zelig 123b 2020-03-02 19:15:23
select
`u`.`name` AS `name`,
`last`.`date` AS `lastChatDate`,
`u`.`id` AS `id`,
`u`.`phone` AS `phone`
from
(
`user` `u` ,
(
select
`support_messages`.`userId` AS `userId`,
`support_messages`.`fromNumber` AS `fromNumber`,
`support_messages`.`date` AS `date`
from
`support_messages`
where
`support_messages`.`id` in
(
select
max(`support_messages`.`id`)
from
`support_messages`
group by
`support_messages`.`userId`
)
)
`last`
)
where
(
(`u`.`id` = `last`.`userId`)
and
(
`last`.`fromNumber` <> 'support'
)
)
ORDER BY
`u`.`id` DESC
最佳答案
对于 mysql 5.7 或更早版本:
SELECT u.`name` AS `name`,
l.`date` AS `lastChatDate`,
u.`id` AS `id`,
u.`phone` AS `phone`,
(SELECT MAX(p.`date`) FROM `support_messages` p WHERE p.userId = l.userId AND p.`date`<l.`date`) AS preLastChatDate
FROM (
select
m.`userId` AS `userId`,
MAX(m.`date`) AS `date`
from
`support_messages` m
group by m.`userId`) l
INNER JOIN `support_messages` lm
ON lm.`userId`=l.`userId`
AND lm.`date`=l.`date`
INNER JOIN `user` u
ON u.id=l.`userId`
WHERE lm.`fromNumber` <> 'support'
关于mysql - 选择具有未答复的支持票的用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60565140/
我做了一个投票按钮Here但我面临的唯一问题是,用户可以无限次投票。我不知道如何限制每个设备/浏览器 1 票。有人可以帮助我吗? 最佳答案 一个简单的方法是使用 cookie 或本地存储。 funct
我真正想要的是限制每人 1 票,但我能想到的下一个最好的事情是限制每个 IP 地址 1 票,以防止恶意用户/黑客严重篡改我公司的投票系统。我正在考虑使用数据库来跟踪 IP 地址。 更新:抱歉第一次没说
我正在从头开始创建我的第一个应用程序,它是 Android 上的一个论坛应用程序,我已经进入了它的赞成票/反对票部分。 我已将其设置为我的用户可以投反对票(类似于 StackOverflow),但我不
这是我的问题,我似乎无法弄清楚如何调用 ParkingTicket 对象 if (carMinutesPaid>meterMinutesPaid)?任何人都可以帮忙,下面是该问题的详细信息。 publ
我的网站上有投票系统,它将每个用户的投票存储在名为 skmp_voting 的表中,该数据库中的每条记录都有 id、item_id (这是文章用户投票的 id)和 vote_value 。 vote_
我如何使用 soap api 显示所有 otrs 门票。可以通过在 url 中传递票证 ID 来显示个人票证,如下所示: $url = "https://url/otrs/rpc.pl"; ////
在学习 Meteor 框架的过程中,我正在将 Yik Yak 移动应用程序重新创建为 Web 应用程序。但该应用程序是完全匿名的,没有用户帐户,但您仍然只能对帖子投赞成票或反对票一次。如何做到这一点?
我是一名优秀的程序员,十分优秀!