You are here: sum a table within a table « MsSQL Server « IT news, forums, messages
sum a table within a table

Posted by solonzenetzis on 02/18/07 11:54

hello

I need some help. The following query works perfectly:
------------------------------------------------------------------
select *
from tableA, tableB

where tableA.num=tableB.order

and tableA.num in (
select tableB.order from tableA, tableB
where
tableB.order=tableA.num
and tableB.cust_no=4895
)
------------------------------------------------------------------
I need to do the following:
------------------------------------------------------------------
select *
from tableA, tableB

where tableA.num=tableB.order

and tableA.num in (
select tableB.order, sum(tableB.ok) as s_ok from tableA, tableB
where
tableB.order=tableA.num
and tableB.cust_no=4895
and s_ok<5
)
------------------------------------------------------------------
but it is not possible
Can anyone help me?

thank you in advance

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация