zoukankan      html  css  js  c++  java
  • 用户关注 和关注用户 成为好友

    (当用户关注的人也关注了用户 即为好友) 

    用户关注表 

    test_user_attention  两个主键 

    attention_id   test_user_attention_id  status 

    (attention_id 和 test_user_attention_id ) 为主键 (不递增) (status 都为1 的时候 用户成为好友)

     使用一条sql 语句查询出来 为用户好友的 信息 

    主要体现知识点(表 与表之间 进行关联 使用 可以使用逗号 (,) 用于一对一的数据表 ) 表的名称可以使用as 进行别名处理

    SELECT ts.* from `test_user_attention` as ts ,`test_user_attention` as ts1 where ts.attention_id = ts1.test_user_attention_id  and ts.test_user_attention_id = ts1.attention_id and ts.`stauts` = 1 AND ts1.`stauts` = 1 and ts.attention_id = 1

    即为已关注了2   用户 2  也关注了用户1 

  • 相关阅读:
    struts2之拦截器
    JavaWeb开发之HttpServletResponse
    JavaWeb开发之Servlet
    HTTP协议详解
    字符串
    数组
    第一个只出现一次的字符
    DDoS的类型及原理
    引用变量&和指针*的区别
    赋值运算符的重载
  • 原文地址:https://www.cnblogs.com/abcdefghi123/p/14994393.html
Copyright © 2011-2022 走看看