Sql/mysql Statement instances (updated ...)

Source: Internet
Author: User

The data structure of table T_alibaba_data is as follows:

The meanings of each column are:

User ID (user_id), Brand ID (brand_id), user behavior (type, where the click is 0, purchase is 1, add to 2, add to Cart 3), the time of the Act (visit_datetime) is generated.

First, use an SQL statement to find the user who clicked on the Hot Brands (TOP10)

Select distinct user_id  fromT_alibaba_datawhereType= 0  andbrand_idinch(Selectbrand_id from(SelectBRAND_ID,Count(brand_id) asnew_brand_id fromT_alibaba_datawhereType= 1 Group  bybrand_idOrder  bynew_brand_iddescLimit0,Ten) alias_t1);

Sql/mysql Statement instances (updated ...)

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.