mysql联表查询

第一种方式:(子查询方式)

select *  from duration where account_idAccount= any(select account.idAccount from account where account.user_idUser= any(select user.idUser from user where user.userName= ?))

第二种方式:(join方式)

 select duration.*from duration inner join account,user where duration.account_idAccount=account.idAccount and account.user_idUser=user.idUser and userName=?


猜你喜欢

转载自smllys.iteye.com/blog/1671220