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 |
|
lovehui
Yak Posting Veteran
60 Posts |
Posted - 2009-03-20 : 11:21:02
|
| [code]select RegID = 'ALL', RptGrp = 1, ColName = T.TND_DESCR, ColAmt=isnull(sum(L.TND_ACCM_AMT),0) , ColCount=isnull(sum(L.TND_TRAN_CNT),0), EmpID ='ALL'from TENDER T inner join TILL_TND_CUR Lon T.TND_CD = L.TND_TYP_CD and T.STR_ID = L.STR_IDwhere L.RGST_MDE = 0 and T.TND_CD = 1 and T.ACT_FG <> 0 group by T.TND_DESCR[/code]But it is working if[code]select RegID = 'ALL', RptGrp = 1, ColName = 'CASH', ColAmt=isnull(sum(L.TND_ACCM_AMT),0) , ColCount=isnull(sum(L.TND_TRAN_CNT),0), EmpID ='ALL'from TENDER T inner join TILL_TND_CUR Lon T.TND_CD = L.TND_TYP_CD and T.STR_ID = L.STR_IDwhere L.RGST_MDE = 0 and T.TND_CD = 1 and T.ACT_FG <> 0 [/code]When T.TND_CD=1,T.TND_DESCR='CASH'Thanks for help |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-20 : 11:59:31
|
| didnt understand your question |
 |
|
|
lovehui
Yak Posting Veteran
60 Posts |
Posted - 2009-03-20 : 12:13:33
|
| I mean T.TND_DESCR has many types such as 'CASH','CHECK'....In the tender table[CODE]TND_CD TND_DESCR1 CASH2 CHECK3 VISA[/CODE]I want to get the value for 'CASH', the issue is if I add group by T.TND_DESCR it return a null. I used a hard copy 'CASH'but it maybe not good. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-20 : 12:32:06
|
what does this return?select RegID = 'ALL', RptGrp = 1, ColName = T.TND_DESCR, ColAmt=isnull(sum(L.TND_ACCM_AMT),0) , ColCount=isnull(sum(L.TND_TRAN_CNT),0), EmpID ='ALL'from TENDER T inner join TILL_TND_CUR Lon T.TND_CD = L.TND_TYP_CD and T.STR_ID = L.STR_IDwhere L.RGST_MDE = 0 and T.TND_CD = 1 and T.ACT_FG <> 0 and LTRIM(RTRIM(T.TND_DESCR))='CASH' group by T.TND_DESCR |
 |
|
|
BJM RAO
Starting Member
20 Posts |
Posted - 2009-03-20 : 13:22:58
|
| Didnt get u ... |
 |
|
|
lovehui
Yak Posting Veteran
60 Posts |
Posted - 2009-03-20 : 13:52:36
|
quote: Originally posted by visakh16 what does this return?select RegID = 'ALL', RptGrp = 1, ColName = T.TND_DESCR, ColAmt=isnull(sum(L.TND_ACCM_AMT),0) , ColCount=isnull(sum(L.TND_TRAN_CNT),0), EmpID ='ALL'from TENDER T inner join TILL_TND_CUR Lon T.TND_CD = L.TND_TYP_CD and T.STR_ID = L.STR_IDwhere L.RGST_MDE = 0 and T.TND_CD = 1 and T.ACT_FG <> 0 and LTRIM(RTRIM(T.TND_DESCR))='CASH' group by T.TND_DESCR
It doesn't work and hardcopy is used.I want to avoid use hardcopy 'CASH'. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-03-20 : 13:55:28
|
| are you usre record containing CASH value satisfy other conditions (L.RGST_MDE = 0 and T.TND_CD = 1 and T.ACT_FG <> 0) |
 |
|
|
lovehui
Yak Posting Veteran
60 Posts |
Posted - 2009-03-20 : 14:16:48
|
| Well, I am sure. |
 |
|
|
|
|
|
|
|