Counts the number of times a column appears in a certain organization by month.

Source: Internet
Author: User
Design a table a with the user_id user iduser_name user name web_id user's website idcreatetime User Creation Time requirement: count the number of new users per month for each website id selectcount (*), to_char (. createtime, yyyy-mm),. web_idfrom table awherea. createtimeisnotnullgr

Design a table a with the user_id user id user_name user name web_id user website id createtime User Creation Time requirement: count the number of new users per month for each website id select count (*), to_char (. createtime, yyyy-mm),. web_id from Table a where. createtime is not null gr

Design a table. The structure of Table a is

User_id user ID

User_name User Name

Web_id website id of the user

Createtime User Creation Time

Requirement: count the number of new users per month for each website id

Select count (*), to_char (a. createtime, 'yyyy-mm'), a. web_id

From table a where a. createtime is not null

Group by to_char (a. createtime, 'yyyy-mm'),/* calculate by creation time */

A. web_id/* statistics by website */

Order by.Web_id, To_char (a. createtime, 'yyyy-mm') desc;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.