限制查询中的重复项而不是表 [英] restrict duplicates in a query not a table
问题描述
我正在连接现有ODBC数据源中的表并从中运行查询。在其中一个查询中,我试图获取去年有活动的帐户列表。问题是如果一个帐户有多个活动日期,它显示两次或更多,我只想看一次。我想限制一个帐号字段只允许帐户显示一次,但我不知道如何。
任何帮助都将受到赞赏。
I am linking tables from an existing ODBC data source and running queries from them. In one of the queries I''m trying to get a list of accounts that have had activity in the last year. The problem is if an account has had multiple activity dates it is showing twice or more and I only want to see it once. There is an account number field that I want to restrict to only have the account show once but I don''t know how.
Any help would be appreciated.
推荐答案
我从现有ODBC数据源链接表并从中运行查询。在其中一个查询中,我试图获取去年有活动的帐户列表。问题是如果一个帐户有多个活动日期,它显示两次或更多,我只想看一次。我想限制一个帐号字段只允许帐户显示一次,但我不知道如何。
任何帮助将不胜感激。
I am linking tables from an existing ODBC data source and running queries from them. In one of the queries I''m trying to get a list of accounts that have had activity in the last year. The problem is if an account has had multiple activity dates it is showing twice or more and I only want to see it once. There is an account number field that I want to restrict to only have the account show once but I don''t know how.
Any help would be appreciated.
请发布您当前使用的查询的SQL。
Please post the SQL of the query you are currently using.
请发布您当前使用的查询的SQL。
Please post the SQL of the query you are currently using.
我还是新手,我想这就是你想要的,如果不是,请告诉我。
SELECT DISTINCT PBR_PbrAcct1.Actnum,PBR_PbrAcctDemMain1.Patnum,PBR_PbrAcctDemMain1.Name,PBR_PbrAcctPtAddrEtc1.Addr1,PBR_PbrAcctPtAddrEtc1.Addr2,PBR_PbrAcctPtAddrEtc1.City,PBR_PbrAcctPtAddrEtc1.State,PBR_PbrAcctPtAddrEtc1.Zip,PBR_PbrAcctPtAddrEtc1.HomePhone,PBR_PbrAcctPtAddrEtc1.OtherPhone,PBR_PbrAcctTxnsFinancial1.TxnLocation <登记/>
FROM(((((PBR_PbrActTxnsSerDateX1 INNER JOIN PBR_PbrAcct1 ON PBR_PbrActTxnsSerDateX1.Account = PBR_PbrAcct1.Account)INNER JOIN PBR_PbrAcctDemMain1 ON PBR_PbrAcct1.Account = PBR_PbrAcctDemMain1.Account)INNER JOIN PBR_PbrAcctPtAddrEtc1 ON PBR_PbrAcctDemMain1.Account = PBR_PbrAcctPtAddrEtc1.Account) INNER JOIN PBR_PbrAcctTxnsFinancial1 ON PBR_PbrAcctPtAddrEtc1.Account = PBR_PbrAcctTxnsFinancial1.Account)INNER JOIN PBR_PbrDoctorDict1 ON PBR_PbrAcctTxnsFinancial1.TxnDoctor = PBR_PbrDoctorDict1.Mnemonic)INNE R JOIN PBR_PbrProcDict1 ON PBR_PbrAcctTxnsFinancial1.TxnProcedure = PBR_PbrProcDict1.Mnemonic
WHERE(((PBR_PbrDoctorDict1.DbLvlB)= [练习])AND((PBR_PbrProcDict1.Type)=" CHG")AND((PBR_PbrActTxnsSerDateX1。 TxnSerDate)> = [来自日期]和(PBR_PbrActTxnsSerDateX1.TxnSerDate)< = [直到日期]));
I''m still new to this, I think this is what you are wanting, let me know if it is not.
SELECT DISTINCT PBR_PbrAcct1.Actnum, PBR_PbrAcctDemMain1.Patnum, PBR_PbrAcctDemMain1.Name, PBR_PbrAcctPtAddrEtc1.Addr1, PBR_PbrAcctPtAddrEtc1.Addr2, PBR_PbrAcctPtAddrEtc1.City, PBR_PbrAcctPtAddrEtc1.State, PBR_PbrAcctPtAddrEtc1.Zip, PBR_PbrAcctPtAddrEtc1.HomePhone, PBR_PbrAcctPtAddrEtc1.OtherPhone, PBR_PbrAcctTxnsFinancial1.TxnLocation
FROM (((((PBR_PbrActTxnsSerDateX1 INNER JOIN PBR_PbrAcct1 ON PBR_PbrActTxnsSerDateX1.Account = PBR_PbrAcct1.Account) INNER JOIN PBR_PbrAcctDemMain1 ON PBR_PbrAcct1.Account = PBR_PbrAcctDemMain1.Account) INNER JOIN PBR_PbrAcctPtAddrEtc1 ON PBR_PbrAcctDemMain1.Account = PBR_PbrAcctPtAddrEtc1.Account) INNER JOIN PBR_PbrAcctTxnsFinancial1 ON PBR_PbrAcctPtAddrEtc1.Account = PBR_PbrAcctTxnsFinancial1.Account) INNER JOIN PBR_PbrDoctorDict1 ON PBR_PbrAcctTxnsFinancial1.TxnDoctor = PBR_PbrDoctorDict1.Mnemonic) INNER JOIN PBR_PbrProcDict1 ON PBR_PbrAcctTxnsFinancial1.TxnProcedure = PBR_PbrProcDict1.Mnemonic
WHERE (((PBR_PbrDoctorDict1.DbLvlB)=[Practice]) AND ((PBR_PbrProcDict1.Type)="CHG") AND ((PBR_PbrActTxnsSerDateX1.TxnSerDate)>=[from Date] And (PBR_PbrActTxnsSerDateX1.TxnSerDate)<=[Thru Date]));
这些列中的哪一列具有在同一列中不同的数据账户。
BR_PbrAcct1.Actnum,
PBR_PbrAcctDemMain1.Patnum,
PBR_PbrAcctDemMain1.Name,
PBR_PbrAcctPtAddrEtc1.Addr1,
PBR_PbrAcctPtAddrEtc1.Addr2,
PBR_PbrAcctPtAddrEtc1.City,
PBR_PbrAcctPtAddrEtc1.State,
PBR_PbrAcctPtAddrEtc1。邮编,
PBR_PbrAcctPtAddrEtc1.HomePhone,
PBR_PbrAcctPtAddrEtc1.OtherPhone,
PBR_PbrAcctTxnsFinancial1.TxnLocation
Which of these columns has data that''s different within the same Account.
BR_PbrAcct1.Actnum,
PBR_PbrAcctDemMain1.Patnum,
PBR_PbrAcctDemMain1.Name,
PBR_PbrAcctPtAddrEtc1.Addr1,
PBR_PbrAcctPtAddrEtc1.Addr2,
PBR_PbrAcctPtAddrEtc1.City,
PBR_PbrAcctPtAddrEtc1.State,
PBR_PbrAcctPtAddrEtc1.Zip,
PBR_PbrAcctPtAddrEtc1.HomePhone,
PBR_PbrAcctPtAddrEtc1.OtherPhone,
PBR_PbrAcctTxnsFinancial1.TxnLocation
这篇关于限制查询中的重复项而不是表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!