日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql normal like_MYSQL语句

發布時間:2025/3/15 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql normal like_MYSQL语句 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

查詢小于某個時間

SELECT COUNT(*) FROM auth_user

WHERE date_joined <= '2017-06-04';

# 加了時區進行查詢,東八區,上海,顯示北京時間

SELECT count(1) FROM auth_user

WHERE (date_joined + INTERVAL 8 HOUR) <= '2017-06-05';

hue中日常用到的語句

獲取周報---先不用

select * from t_week_mail

獲取developer---先不用

SELECT

u.id,u.email,u.username,u.last_login,u.date_joined,f.mobile,f.qq,f.address

FROM

default.mysql_auth_user u

LEFT JOIN

default.mysql_gizwits_site_userprofile

f

on u.id = f.user_id

獲取auth_user

SELECT * from mysql_auth_user

獲取mysql_organization

select * from mysql_organization

獲取gizwits_site_userprofile

select * from mysql_gizwits_site_userprofile

獲取mysql_gizwits_site_member (role_id)

select * from mysql_gizwits_site_member

獲取device_count

select

p.user_id,

t.total_device as dev_count

from

(

select

lower(product_key) as pk,

SUM(device_count) AS total_device

from

analyzedb.t_incr_device

group by lower(product_key)

) t

right join default.mysql_gizwits_site_product p

on lower(t.pk) = lower(p.product_key)

獲取new_device

SELECT p.verbose_name,p.product_key,o.name as com_name,p.user_id,p.type,

d.device_count,d.created_at

from default.mysql_gizwits_site_product p

left join analyzedb.t_incr_device d

on d.product_key = p.product_key

left join default.mysql_organization o

on p.organization_id = o.id

還在嘗試

SELECT p.id, p.product_key, p.verbose_name, p.is_adaptive_datapoint, d.device_count, c.product_id, o.name as organization_name

FROM default.mysql_gizwits_site_product as p LEFT JOIN default.mysql_gizwits_site_centralcontrolproduct as c

on p.id = c.product_id

LEFT JOIN analyzedb.t_incr_device as d on lower(p.product_key) = lower(d.product_key)

LEFT JOIN default.mysql_organization as o on p.organization_id = o.id

新語句

query_result

select

p.id,

p.product_key,

p.verbose_name,

p.is_adaptive_datapoint,

t.total_device,

c.product_id,

o.name as organization_name

from

(

select

lower(product_key) as pk,

SUM(device_count) AS total_device

from

analyzedb.t_incr_device

group by lower(product_key)

) t

right join default.mysql_gizwits_site_product p

on lower(t.pk) = lower(p.product_key)

left join default.mysql_gizwits_site_centralcontrolproduct c

on p.id = c.product_id

left join default.mysql_organization o

on p.organization_id = o.id

mongo_device

select m.product_key, m.is_codegen

from default.mongo_device m

where (m.year >= 2017) and (m.month >= 6) and (m.day >= 14) and (m.is_codegen = true)

select

lower(product_key),

SUM(device_count) AS total_device

from

analyzedb.t_incr_device

group by lower(product_key)

最后匯總

select

p.id,

p.product_key,

p.verbose_name,

p.is_adaptive_datapoint,

t.total_device,

c.product_id,

o.name as organization_name,

mongo.product_key, mongo.is_codegen

from

(

select

lower(product_key) as pk,

SUM(device_count) AS total_device

from

analyzedb.t_incr_device

group by lower(product_key)

) t

right join default.mysql_gizwits_site_product p

on lower(t.pk) = lower(p.product_key)

left join default.mysql_gizwits_site_centralcontrolproduct c

on p.id = c.product_id

left join default.mysql_organization o

on p.organization_id = o.id

left join (select m.product_key, m.is_codegen

from default.mongo_device m

where (m.year >= 2017) and (m.month >= 6) and (m.day >= 14) and (m.is_codegen = true)) mongo

on lower(mongo.product_key) = lower(p.product_key)

會不會忘記加distinct

select count(mac) from mongo_device where year = 2017 and month=6 and is_codegen=true and default.mac2type(mac)='NORMAL_MAC'

可能用到的

SELECT * from superset_retention

order by time DESC

limit 3

like

select * from mysql_gizwits_site_product where verbose_name like '%Allpay%'

select * from mysql_organization where name like '%奧付云%'

奧付云(AllpayV2_1正式平臺)的設備累計數

select * from analyzedb.t_incr_device where product_key = '41755b79b566447d9b217c20bfaac91f'

select

sum(device_count)

from analyzedb.t_incr_device

where created_at<20170301 and lower(product_key)="41755b79b566447d9b217c20bfaac91f"

select

incr.created_at as created_at,

SUM(incr.count) OVER (ORDER BY incr.created_at ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS device_count

from (

select

created_at ,

CASE WHEN created_at=20170301 then sum(device_count)+8250 else sum(device_count) end as count

from analyzedb.t_incr_device

where created_at>=20170301 and lower(product_key)="41755b79b566447d9b217c20bfaac91f" group by created_at

) incr

bumblebee

SELECT * FROM `device_settings` where device_id in

(select device_id from device_settings GROUP BY device_id HAVING count(device_id) > 1);

獲取user_id 和 dev_count

select

p.user_id,

t.total_device as dev_count

from

(

select

lower(product_key) as pk,

SUM(device_count) AS total_device

from

analyzedb.t_incr_device

group by lower(product_key)

) t

right join default.mysql_gizwits_site_product p

on lower(t.pk) = lower(p.product_key)

總結

以上是生活随笔為你收集整理的mysql normal like_MYSQL语句的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。