下面的脚本仅显示它们在表issuemail和数量上都具有的数据。我希望所有数据都应显示在表格问题邮件中,如果金额表中没有该金额,则金额将变为o .......
卡号和条形码在签发表中是唯一的,不会重复..............在数量上卡号可能会重复,但卡号和条形码都不会一起重复.......

Select issuemail.borrowernumber,
  issuemail.cardnumber,
  issuemail.firstname,
  issuemail.surname,
  issuemail.title,
  issuemail.author,
  issuemail.barcode,
  issuemail.issuedate,
  issuemail.date_due,
  amount.amount
From issuemail Inner Join
  amount On amount.cardnumber = issuemail.cardnumber And amount.barcode =
    issuemail.barcode

最佳答案

尝试改用左联接。

    Select issuemail.borrowernumber,
    issuemail.cardnumber,
    issuemail.firstname,
    issuemail.surname,
    issuemail.title,
    issuemail.author,
    issuemail.barcode,
    issuemail.issuedate,
    issuemail.date_due,
    amount.amount
    From issuemail Left Join
    amount On amount.cardnumber = issuemail.cardnumber And amount.barcode =
    issuemail.barcode

10-08 11:09