如何根据日期/时间获得第一个和最后一个 [英] How to get first and last recird depending on date/time

查看:85
本文介绍了如何根据日期/时间获得第一个和最后一个的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,用于存储日期/时间和客户名称.

我想选择根据日期/时间输入的第一个客户,并选择最后一个客户.

I have a table which I store the date/time and the customer name.

I want to select the first customer entered according to the date/time and same the last customer.

推荐答案

最新:
SELECT * FROM myTable WHERE dateChanged=(SELECT MAX(dateChanged) FROM myTable)


最旧的:


Oldest:

SELECT * FROM myTable WHERE dateChanged=(SELECT MIN(dateChanged) FROM myTable)


这篇关于如何根据日期/时间获得第一个和最后一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆