• 常用SQL


    查询类:

    select* from SignPointActivity 

    select* from SignPointActivity where Title='一个签到'

    select* from SignRecords  where Memberlogin='13800138000'  and ActivityID=329

    select * from MemberSignatureCard where Memberlogin='13800138000' and OpenID='os9ZrtwmqazVNkTuIg2wvQCmsr3c' and ActivityID='319' order by AddTime
    update MemberSignatureCard set IsUse=0 where ID in('28','29','30','31','32','33','34','35')

    select SalesRecords.orderID,Orders.openid from SalesRecords as SalesRecords left join Orders as Orders on SalesRecords.orderID=Orders.orderID where
    SalesRecords.productname='特殊测试虚拟' and SalesRecords.PublishedTime>'2018-01-18 14:46:00' and SalesRecords.PublishedTime<'2018-01-18 15:46:00'

    SELECT ((Commentcount*0.4+Viewcount*0.3+Likecount*0.3)/ power((DATEDIFF(d, Createtime, GETDATE())+2.000000),1.8)) as hot ,Title,Commentcount,Viewcount,Likecount FROM [dbo].[Article]  where Status in ('1','2') and MemberLogin='1008601' ORDER BY hot DESC;

    添加类:

    insert into SignRecords (Openid,NickName,YYYYMMDD,hbSend,Memberlogin,ActivityID,TotalNumber)
    values ('os9ZrtwmqazVNkTuIg2wvQCmsr3c','Jerry','2017-04-30',0,13800138000,302,1);

    DECLARE @i int
    DECLARE @opid nvarchar(200)
    Set @i = 1
    SET @opid='123123123'

    WHILE @i < 5000
    BEGIN
    Set @i =@i +1
    set @opid = @opid+@i
    insert into Fact_Statistic_SignatureCard(RQ,Memberlogin,ActivityID,Openid,Num,UseNum,IsDelete,InvitationNum,AddTime) values('2017-04-27','13800138000',237,@opid,2,3,0,0,'2017-04-27 19:00:44.407')
    END

    删除类:

    delete from SignPointActivity where ID = '412' 

    delete from SignRecords where ID in(22029,
    22055,
    22056,
    22057,
    22059,
    22062)

    更新类:

    update SignPointActivity set EndTime='2017-11-30 11:43:00' where ID=407

  • 相关阅读:
    mysql数据库的test类型
    jvm虚拟机分享课笔记
    内存模型中没有gc的是哪个
    jvm内存模型中-栈,方法区,程序计数器是线程安全的
    Random.nextInt()替换Math.random()
    异常抛出注意点
    缓存好文章
    java 实现serialVersionUID
    什么叫反向代理什么叫正向代理
    mysql count与sum的区别
  • 原文地址:https://www.cnblogs.com/testwjr/p/8664472.html
Copyright © 2020-2023  润新知