Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2006, 08:41 PM
Authorized User
 
Join Date: Sep 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to split a field into two fields

I have the following fields in table A:

 GL_ID| Date |GL_Name_VC | Amount |Period_TI|Year_SI
================================================== =============
  1000|31/12/2005 | Sales | -8,000.00 | 12 | 2005
================================================== =============
  1000|06/01/2006 | Sales | -6,000.00 | 01 | 2006
================================================== =============
  1000|20/01/2006 | Sales | 2,000.00 | 01 | 2006
================================================== =============
  1000|28/01/2006 | Sales | -4,000.00 | 01 | 2006

The above database is running on Microsoft SQL Server 2000 and i would like to query
for a report that looks something as below:

Period | Date | GL_Name_VC | Debit | Credit| Net Change | Balance
================================================== ===================
01 |01/01/2006|Opening Bal | 0 | 0 | 0 | 8,000
01 |06/01/2006|Sales | 0 | 6,000 | 0 | 0
01 |20/01/2006|Sales | 2,000 | 0 | 0 | 0
01 |28/01/2006|Sales | 0 | 4,000 | 8,000 |16,000


The formula for the above calculated fields are as below:

Opening Balance = carried forward balance from Year 2005
          Debit = All positive amount
         Credit = All negative amount
     Net Change = Total Credit - Total Debit in Period 01
        Balance = Total of Net Change + Opening Bal

Guys, hope someone out there can help me with the sql command for the above report?








Similar Threads
Thread Thread Starter Forum Replies Last Post
To Split or Not to Split darrenb Access 2 February 8th, 2008 12:28 PM
Split field at designated character but at " " neo_jakey Classic ASP Professional 0 March 14th, 2005 11:31 AM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM
Separating a field into two fields tp194 Access 1 October 8th, 2004 10:02 AM
How Do I Concatinate fields into a key field Brian263 Access 1 May 3rd, 2004 03:00 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.