我需要显示中的列
操作人员
我的问题是:

    SELECT prizes.type,prizes.name
       FROM  lottery_payment_prizes payment
         JOIN lottery_prizes prizes ON
          prizes.id =  payment.prize_id
     WHERE payment.payment_id IN
       (( SELECT id FROM lottery_payments
      WHERE  lottery_id = (SELECT id FROM lotteries WHERE abbr = 'TR' AND group_id = '3' )))

结果是:
我的问题是:如何显示彩票付款中的两列,
乐透支付只向运营商返回ID
函数。我需要显示彩票付款表中的列名“place”。
谢谢大家。

最佳答案

如果需要lottery_payments中的列,则需要向其添加联接:

SELECT payments.place, payments.id, prizes.type, prizes.name
   FROM  lottery_payment_prizes payment
     JOIN lottery_prizes prizes ON
      prizes.id =  payment.prize_id
     JOIN lottery_payments payments ON
      payment.payment_id =  payments.id
 WHERE lottery_id = (SELECT id FROM lotteries WHERE abbr = 'TR' AND group_id = '3' )

关于sql - SQL SHOW还有一个列名FROM运算符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/4386288/

10-13 07:53