SQL多表查询

---------requirement start------------
Query user that subscription of product code PRMALLCHNNL that start at 26 - 30 AUGUST 2021.
Please provide the data following the format below (on TXT file):

Province, City Name, Usercode, UserStatus, SubscribeTime, Productcode, STB ID
-----------requirement end-----------


------------sql start----------------
select c.provname as Province, d.cityname as CityName, a.usercode as Usercode, a.status as UserStatus, b.createtime as SubscribeTime, b.productcode as Productcode, a.stbcode as STBID from s830_user a, s830_user_subs b, s830_province c, s830_city d where a.userid=b.userid and a.provcode=c.provcode and a.citycode=d.citycode and b.productcode='PRMALLCHNNL' and b.createtime>'20210826000000' and b.createtime<'20210830000000';

posted @ 2021-09-01 10:00  zhonghaijing123  阅读(34)  评论(0编辑  收藏  举报