Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summary

Status
Not open for further replies.

zsyed

MIS
Dec 25, 2011
73
CA
I've interesting scenario where a summary is required by division except one division which need to shared with other division. An example data is shown below. MAI need to be split with other divisions whereever the numberic number matches with other parts of the codes. Hope this claries. Should anyone need more clarifications, please let me know. How can I've a SQL query logic to get this result?

div code value
ELE ELE40040000 250
MAI MAI40040000 150
MAI MAI40740000 200
MAI MAI43010000 300
PCE PCE40740000 400
REN REN43010000 100

Result
ELE ELE40040000 250
MAI40040000 150
total ELE 400
PCE PCE40740000 400
MAI40740000 200
Total PCE 600
REN REN43010000 100
MAI43010000 300
Total REN 400

Many Thanks in Advance.
 
this would be something you would need to do in a report but

select substring(code,4,8), sum(substring(code,4,8))
from yourfile
group by substring(code,4,8)

will give you your totals. Post actual desired results if different.

Simi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top