MYSQL Inner Join if statement

前端 未结 2 629
逝去的感伤
逝去的感伤 2021-01-13 05:11

i\'m trying to join 3 tables together but use an IF statment to only run a certain query

I have a user table, customer and staff table. The first part below works:

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 05:45

    Doesn't this works?

    INNER JOIN `staff` ON `user`.userID = staff.userID AND user.level = 2
    INNER JOIN `customer` ON user.userID = customer.userID AND user.level = 1 
    

提交回复
热议问题