zoukankan      html  css  js  c++  java
  • mysql 联表操作

    select * from userinfo5,department5

    select * from userinfo5,department5 where userinfo5.part_id = department5.id

    select * from userinfo5 left join department5 on userinfo5.part_id = department5.id
    select * from department5 left join userinfo5 on userinfo5.part_id = department5.id
    # userinfo5左边全部显示


    # select * from userinfo5 right join department5 on userinfo5.part_id = department5.id
    # department5右边全部显示



    select * from userinfo5 innder join department5 on userinfo5.part_id = department5.id
    将出现null时一行隐藏

    #

    select * from (
    select test1.id,test1.num as n1,test1.name,test2.num as n2 from test1 left join test2 on test1.num = test2.num
    UNION
    select test1.id,test1.num as n1,test1.name,test2.num as n2 from test2 left join test1 on test1.num = test2.num) as B

    全部显示

  • 相关阅读:
    VBA键码常数
    枚举
    海龟交易法则及头寸
    HQL.TOP
    jquery.cookie
    机械操作产品分析.
    Repeater排序2
    Repeater排序
    json
    LoginStatus注销控件
  • 原文地址:https://www.cnblogs.com/hlan/p/6957561.html
Copyright © 2011-2022 走看看