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 |
|
thiagocrk
Starting Member
1 Post |
Posted - 2009-06-04 : 16:36:16
|
| ( Select sum(T16.[Quantity] / ''6'') as mediaFROM ORDR T17 INNER JOIN RDR1 T16 ON T17.DocEntry = T16.DocEntryWHERE T17.[DocDate] >= (convert(DateTime, Coalesce ('''+@periodoInicial+''',''01/01/1900''),103))AND T17.[DocDate] <= (convert(DateTime, Coalesce ('''+@periodoFinal+''',''01/01/1900''),103))and T16.[ItemCode] = lcm.ItemCode ) media, ====> Select This brings me to a media correctly thereby creating the "media" ok?pesquisarNow here I want to get this field "media" and sum it for me to bring the total value of Media. What to do?( Select sum(media) as TotalMedia FROM ORDR T20 INNER JOIN RDR1 T21 ON T20.DocEntry = T21.DocEntry where DocStatus in ('+@Status+') )MediaTotal |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2009-06-04 : 21:43:50
|
post some sample data, table stucture and desired results. Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-05 : 13:24:44
|
| why are you using dynamic sql here? |
 |
|
|
|
|
|