[英]Calculate the number of occurrences of the text in Redshift
Calculate the number of occurrences of the text, “university”, anywhere in the "School" field for each day in the 15 day period between 2018-12-15 to 2018-12-31?计算 2018 年 12 月 15 日到 2018 年 12 月 31 日之间的 15 天内,“学校”字段中每一天文本“大学”的出现次数?
Can someone help me with this query?有人可以帮我解决这个问题吗? I am working on a redshift environment.
我正在红移环境中工作。
You haven't supplied any information about the table, but the query would probably be similar to this:您尚未提供有关该表的任何信息,但查询可能与此类似:
SELECT
date_field,
COUNT(*) as qty
FROM table
WHERE
school ILIKE '%university%' AND
date_field BETWEEN '2018-12-15' AND '2018-12-31'
GROUP BY date_field
ORDER BY date_field
This counts the number of rows containing a case-insensitive university
where a date field is between the indicated dates.这计算包含不区分大小写的
university
的行数,其中日期字段在指定日期之间。 This assumes that date_field
is a DATE
, not a TIMESTAMP
.这假设
date_field
是DATE
,而不是TIMESTAMP
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.