Depending on the vest, the App Store, the number of registrations per day, the requirements can be based on the choice of waistcoat and app, waistcoat and Appstrore and user_login different table issues

Source: Internet
Author: User

This vest belongs to a table, appstore another table, the user login table, the main operation is the three tables.

The ID of my vest and app here corresponds to the channel in the User login table, where the channel is Majiaid + "|" + storeId

First edition of SQL:

SelectCOUNT (*), Sms_tag_name, Store_name from               (SelectID, create_date, SUBSTR (channel,0, NVL (INSTR (channel,'|',1,1),0)-1) sms_tag_id, SUBSTR (CHANNEL,NVL (INSTR (channel,'|',1,1),0)+1, Length (channel)-NVL (INSTR (channel,'|',1,1),0)) store_id, channel fromUser_loginwhereNVL (INSTR (channel,'|',1,1),0) !=0) u INNER JOIN majia_sms_tag mst on mst.sms_tag_id=u.sms_tag_id INNER JOIN app_store APs on aps.store_id=u.store_idwhereStore_name='Huawei'GROUP by Sms_tag_name, Store_name

Found that there is a problem, the user login to the farmer does not store the vest and the application store registration amount can not be found, etc., information is not comprehensive

Second Edition:

Selectcount (u.id), Sms_tag_name, Store_name from        (       Selectsms_tag_id, Sms_tag_name, store_id, Store_name, Concat (Concat (sms_tag_id,'|'), store_id) asChannel fromMajia_sms_tag Cross join App_store) Ma left join (Select* fromUser_loginwhereTo_char (Create_date,'Yyyymmddhh24miss') >='20160801000000'and To_char (Create_date,'Yyyymmddhh24miss') <='20170801000000') u on U.channel=Ma.channelwheresms_tag_id='Com.rybring.weilidai'and store_id='platf.360'GROUP by Sms_tag_name,store_nameorder by Sms_tag_name,store_name

The cross join is used, the first wipe is used, and the conditions of the two queries are placed in the subquery and the outside. Genius

Later there are similar requirements can be consulted.

Depending on the vest, the store, the number of registrations per day, the requirements can be based on the choice of vests and apps, vests and appstrore and user_login different table issues

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.