Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
aciccia
Starting Member
8 Posts |
Posted - 2011-08-01 : 21:45:37
|
| I'm trying to get the 2 queries to work together but i'm having no luck. Any suggestions?Thank you,select *from Arr_ANALYTICS.dbo.detail dInner join Arr_analytics.dbo.detail dion d.SD_KEY=di.SD_KEYwhere d.SD_TRAN_CDE_CAT in ('31') and d.SD_BEN_WIR_ACCT_IDENT not like ('%twr%')and d.SD_TERM_NAME_LOC = di.SD_TERM_NAME_LOCand d.md_tran_amt1 > 4999and di.SD_Tran_cde_cat in ('31')and di.SD_BEN_WIR_ACCT_IDENT not like ('%twr%')and di.md_tran_amt1 > 4999AND di.DD_DATE BETWEEN DATEADD(minute, -10, d.DD_DATE) AND DATEADD(second, -5, d.DD_DATE)AND EXISTS (Select SD_DATEKEY from Arr_Analytics.dbo.Detail di1 WHERE di.SD_KEY = di1.SD_KEY and di1.SD_TRAN_CDE_CAT in ('21') and di1.md_tran_amt1 > 10000AND di1.DD_DATE BETWEEN DATEADD(day, -3, di.DD_DATE) AND DATEADD(second, -5, di.DD_DATE))This part would be the second part that I want to incorporate.And EXISTS (SELECT di1.SD_KEY, di1.SD_DATEKEYFROM Arr_Analytics.dbo.Detail di1JOIN Arr_Analytics.dbo.Master mON di1.SD_KEY = m.SM_KEYWHERE m.DM_ACCT_OPN_DAT between '06/01/2011' and '07/27/2011') |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-02 : 01:05:26
|
| what happens when you're just adding AND condition to existing query?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
aciccia
Starting Member
8 Posts |
Posted - 2011-08-02 : 01:24:36
|
| It's just ignoring it |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-02 : 02:23:06
|
| can you show some data sample and explain?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
aciccia
Starting Member
8 Posts |
Posted - 2011-08-02 : 02:38:14
|
| The first query is looking for 2 transactions within 10 minutes for >4999 when there has been a credit applied for >10000 3 days prior to the transactionsthe second part is trying to look for recently created accounts.i'm not quite sure what kind of data sample you need to get a better idea. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|