selecttb.stuname,sum(tb.amount)as总数量,sum(tb.金额)as总金额from(selectta.stuname,ta.amount,ta.amount*book.priceas金额from(selectstudent.stuname,bookorder.bookno,bookorder.amountfromstudentleftjoinbookorderonstudent.stuno=bookorder.stuno)taleftjoinbookonta.bookno=book.bookno)tbgroupbytb.stuname
双表查询:两表查询sql语句[朗读]
@lcgetcom
顶0
加入收藏
相关问答推荐