从时间戳(日期时间)中选择时区 [英] Selecting between timezone from timestamp(datetime)
问题描述
我如何从当前日期的日期时间列中选择两个时间:
How can i select between two times' from datetime column for current day:
谢谢
推荐答案
假设你有基本的 选择语法下来,有一个方便的运算符,BETWEEN
,它可以让您在一对值之间选择行.您还可以使用 >=
和 <=
运算符.例如,通过产品和价格表,您可以找到价格在 5 美元到 10 美元之间的所有产品,如下所示:
Assuming you have the basic select syntax down, there is a convenient operator, BETWEEN
, that will let you pick rows between a pair of values. You can also use the >=
and <=
operators. For example, with a table of products and prices, you could find all the products priced between $5 and $10 like this:
SELECT product_name, product_price FROM products WHERE product_price BETWEEN 5 AND 10
或者,
SELECT product_name, product_price FROM products WHERE product_price >= 5 AND product_price <= 10
这假设您的日期存储在 日期时间类型,而不是文本类型.如果它们是文本类型,您应该修复它.
This assumes your dates are stored in columns of a date-time type, and not a text type. If they're in a text type, you should fix that.
这篇关于从时间戳(日期时间)中选择时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!