zoukankan      html  css  js  c++  java
  • SQL知识积累

    一.如何插入一个单引号,用insert into t_user values ('''',3);

    二.消息表Message:MessageID  
                             SenderID  发送者ID(对应用户表userID)  
                             ReceiverID 接收者ID(对应用户表userID)
                             MessageTime 发送时间
                            Title 消息标题
                            Body 内容

    用户表UserAccount:

    UserID 

    UserAccount

    UserName

    要查询某个人相关的消息(发送者或接收者为同一个人):
    MessageId,发送者姓名,接收者姓名,消息标题,发送时间

    select  m.messageid,

              s.userid as 发送者ID,

              s.username as 发送者姓名,

              r.userid as 接收者ID,

              r.username as 接收者姓名,

              m.title 
    from t_message m  join t_user s on m.senderid=s.userid  
                                join t_user r on m.receiveid=r.userid

    三.在一个时间段内查询用

                      {and m.MessageTime >= #StartTime#}
                      {and m.MessageTime < DATEADD(DAY,1,#EndTime#)} 

  • 相关阅读:
    思考:缓存的使用?灵活运用?
    线程和并发--基础
    java基础--方法
    java基础--数组
    数据结构复习笔记
    asp搭建网站
    转换磁盘格式
    cypress 与其他测试框架的区别
    cypress启动时报错file already exists,文件已经存在解决办法
    cypress的安装
  • 原文地址:https://www.cnblogs.com/ycdx2001/p/1526362.html
Copyright © 2011-2022 走看看