-1

我有两张桌子,它们都有MemberId共同点。我只想返回余额大于 0.00 且计费通知 = 2 的不同帐户,其中结果在某个日期之后。到目前为止,我想出的是:

use Plantation
select tblmember_v62.Acct, tblmember_v62.First, tblmember_v62.Last, tblMemberAccount_v62.Balance
from tblmember_v62, tblMemberAccount_v62
Where dbo.tblMember_v62.MemberId = tblmemberaccount_v62.MemberId
and tblMemberAccount_v62.Balance > '0.00' and tblMember_v62.BillingNotify = '2'
and (tblMemberAccount_v62.InsertDate > '2012-01-01 00:00:00.000' or tblMemberAccount_v62.UpdateDate > '2012-01-01 00:00:00.000')
Order by dbo.tblMemberAccount_v62.MemberId, tblmember_v62.Last

我怎样才能只返回不同的结果?我知道这不应该那么难......

4

1 回答 1

0
use Plantation

select distinct tblmember_v62.Acct, tblmember_v62.First, tblmember_v62.Last, tblMemberAccount_v62.Balance

from tblmember_v62, tblMemberAccount_v62

Where dbo.tblMember_v62.MemberId = tblmemberaccount_v62.MemberId
and tblMemberAccount_v62.Balance > '0.00' and tblMember_v62.BillingNotify = '2'
and (tblMemberAccount_v62.InsertDate > '2012-01-01 00:00:00.000' or tblMemberAccount_v62.UpdateDate > '2012-01-01 00:00:00.000')

Order by dbo.tblMemberAccount_v62.MemberId, tblmember_v62.Last
于 2013-08-15T19:47:17.980 回答