I need to SELECT the rows of 'billing_temp' that doesn't exist in 'billing' based on two columns.
目前我想出了这个查询:
SELECT ControlNum, CarrierName, PhoneNum, PatientName, SubscriberID, SubscriberName,
ChartNum, DoB, SubscriberEmp, VisitID, ServiceDate, ProviderName, CPTCode, BillingDate,
AgingDate, BalanceAmt, Age, AgeCategory FROM billing_temp LEFT JOIN billing
USING (ControlNum, CPTCode) WHERE billing.ControlNum=billing_temp.ControlNum AND
billing.CPTCode=billing_temp.CPTCode
但是我得到了错误:
Column 'ControlNum' in fieldlist is ambiguous.
有没有人遇到过这种情况。
如果您需要更多详细信息来恢复此信息,请通知我.. 帮我。提前致谢..
注意:
很抱歉,我在自己的查询中发现了问题所在。 感谢所有对我的问题感兴趣并发送答案的人..
最佳答案
在多个表中存在的字段名称(在您的查询中)的每次出现都必须是完全限定的。在您的情况下,billing.ControlNum
或 billing_temp.ControlNum
关于mysql - 减去两个基于 2 列的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3468184/