[英]SQL Query and filtering data
I am using a Time Zone database ( https://timezonedb.com/download ) and I'm struggling with a SQL query. 我正在使用时区数据库( https://timezonedb.com/download ),并且正在使用SQL查询。
The validity of a time zone is depends on time_start field in the database. 时区的有效性取决于数据库中的time_start字段。 This is important to get the correct time_start.
这对于获得正确的time_start很重要。
Below are the data 以下是数据
zone_id|zone_name |time_start
391 |America/Los_Angeles|2147397247
391 |America/Los_Angeles|1425808800
391 |America/Los_Angeles|2140678800
391 |America/Los_Angeles|9972000
392 |America/Metlakatla |2147397247
392 |America/Metlakatla |436352400
392 |America/Metlakatla |9972000
393 |America/Anchorage |2147397247
393 |America/Anchorage |2140682400
393 |America/Anchorage |2120122800
393 |America/Anchorage |1425812400
393 |America/Anchorage |9979200
The example below shows how to query the time zone information using zone name America/Los_Angeles
. 下面的示例显示如何使用时区名称
America/Los_Angeles
查询时区信息。
SELECT * FROM timezone
WHERE time_start < strftime('%s', 'now')
AND zone_name='America/Los_Angeles'
ORDER BY time_start DESC LIMIT 1;
This query returns 该查询返回
391|America/Los_Angeles|1425808800
I'd like to to do the same thing but for all zone_id with one SQL Query. 我想做同样的事情,但是对于所有带一次SQL查询的zone_id。
The expected results 预期结果
391|America/Los_Angeles|1425808800
392|America/Metlakatla |436352400
393|America/Anchorage |1425812400
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.