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 |
|
rahulmalhotra26
Starting Member
23 Posts |
Posted - 2008-01-30 : 19:53:04
|
| select column1,column2 from Tableswhere time between 'xxxxxxxx' and 'xxxxxxxx'and (account+Convert(varchar,time,1)) in (select (account+Convert(varchar,time,1))from tablename join table namewhere txntime between 'xxxxxxxx' and 'xxxxxxxx'group by dateadd(d,datediff(d,0,txntime),0),accountno, txntimehaving sum(amount)>=20)i have to goals behing this1. To get the list of accounts that had deposits more then $X amount2. After sorting those records getting detailed depositesFor example:Account Number 1: $10 26th january 2008Account Number 2: $10 26th January 2008Account Number 1: $10 26th january 2008what i want as an output is for accounts havin deposits more then $15 a day:So the output i am looking for is kinda this:Account Number 1deposit of $20: deposit 1 is $10 om 26th january 2008 10:42:xx:xx:XXdeposit 2 is $ 10 on 26th january 2008 14:00:xx:xx:xxTotal Deposit $20NOTE above query would work i hope if i can get time+account but i just cant get as it gives me error for conversion.. please help guysif i dont concatenate with time it doesnt work cauz it gives me the account numbers of the transaction but in outer query it does not compare with the amount to be $20"I have been successful to list just the account numbers of accounts havnig more then or equal to $20, but i can not get the inner query with lists of transactionsRahul |
|
|
rahulmalhotra26
Starting Member
23 Posts |
Posted - 2008-01-30 : 20:02:39
|
| (account+Convert(varchar,time,1)) in (select (account+Convert(varchar,time,1)) I can convert time into integer i guess so that would match,, but now it says time is not in group by clause.. if i put time in group by clause the result changes please tell me a solution to thatRahul |
 |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-01-30 : 23:30:01
|
| Can you give the table structure pls? |
 |
|
|
|
|
|
|
|