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 |
|
gorzowiak
Starting Member
3 Posts |
Posted - 2009-03-09 : 09:35:08
|
| If I type only one table without any aliases everythink is OK, but if I try somethink like this : select sum(sty.kwota), sum(lut.kwota)from tabela sty, tabela lutwhere sty.rok = '2008'and sty.miesiac = '1'and sty.grupa between '400' and '700'and lut.rok = '2008'and lut.miesiac = '2'and lut.grupa between '400' and '700'I get wrong value of sum function.Please help me with that!!!What is wrong ??? |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2009-03-09 : 09:36:43
|
| how do your tables join together?Em |
 |
|
|
gorzowiak
Starting Member
3 Posts |
Posted - 2009-03-09 : 09:40:55
|
| "tabela" is a name of my table, so I think i don't need any join if i have the same table but another alias. Is this right ? |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-03-09 : 09:43:05
|
| u can try like this why u have cross join the table with same tableselect sum(kwota)from tabela where rok = '2008'and miesiac = '1'and grupa between '400' and '700' |
 |
|
|
gorzowiak
Starting Member
3 Posts |
Posted - 2009-03-09 : 09:52:54
|
| I'm trying to creat a report with fields :Name ; January, February, March, ......, Year 2008,and I have a table named 'tabela' with fields:number of orders; kwota; year; month;So, I don,t see another way to creat this raport like : alias for "tabela" for every fields : January, Febr, March, ...., Year ??? Is this right ?? |
 |
|
|
|
|
|
|
|