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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Adding Strings

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-04-01 : 09:15:18
Moez Vallani writes "I have a table of Rules which describes formulas for a type. Here is the table format:

Rule    TypeID  RTypeID RTSecID   
A 100 100 1
C 100 100 2
B 100 200 1
D 100 200 2
A 100 300 1
I 100 300 2
B 100 400 1
N 100 400 2
G 100 400 3


Basically for each TypeID there will be formulas created so in this example for TypeID 100 the formulas are listed for different RTypeID

A + C
B + D
A + I
B + N + G


How can I use one SQL Statement to return this 4 records above?

Thanks
"

Nazim
A custom title

1408 Posts

Posted - 2002-04-01 : 09:20:52
select typeid,rtypeid, sum(rtsecid)
from tablename
where typeid=100
group by typeid,typeid

HTH


--------------------------------------------------------------
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-04-01 : 10:08:01
If you are asking about specifically about the strings , follow this link rrb has written a nice sp to do it
http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=14095

--------------------------------------------------------------
Go to Top of Page
   

- Advertisement -