Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I split a column?

Posted on 2009-05-20
10
Medium Priority
?
206 Views
Last Modified: 2012-05-07
Now I have one column that has positive and negative values, Now I want to split this column the positive and negative shoaled be separated

how do I do it?

Thanks for any help
0
Comment
Question by:AYid
  • 5
  • 5
10 Comments
 
LVL 15

Expert Comment

by:MNelson831
ID: 24435327
Select
     Case
          When MyFieldValue < 0 then MyFieldValue
          Else 0
     End as MyNegNumbers,
     Case
          When MyFieldValue > 0 then MyFieldValue
          Else 0
     End as MyPosNumbers
From
     MyTableName
Where
     MyCriteria = True



     
0
 
LVL 1

Author Comment

by:AYid
ID: 24435388
I'm getting an error

syntax error
0
 
LVL 1

Author Comment

by:AYid
ID: 24435417

syntax error (missing operator) in query expression

Open in new window

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 15

Expert Comment

by:MNelson831
ID: 24435435
Are you running this in Access or SQL?
0
 
LVL 1

Author Comment

by:AYid
ID: 24435460
Accses
0
 
LVL 15

Expert Comment

by:MNelson831
ID: 24435465
SELECT IIf([MyDataField]>0,[MyDataField],0) AS MyPosNums, IIf([MyDataField]<0,[MyDataField],0) AS MyNegNums
FROM MyTableName;
0
 
LVL 15

Expert Comment

by:MNelson831
ID: 24435476
Look in this file for example
db9.mdb
0
 
LVL 1

Author Comment

by:AYid
ID: 24435701
Thanks it works great!!!

one more thing.. what is the syntax to format it as currency?
0
 
LVL 15

Accepted Solution

by:
MNelson831 earned 500 total points
ID: 24435996
SELECT Format(IIf([MyDataField]>0,[MyDataField],0),"Currency") AS MyPosNums, Format(IIf([MyDataField]<0,[MyDataField],0),"Currency") AS MyNegNums
FROM MyTableName;

0
 
LVL 1

Author Closing Comment

by:AYid
ID: 31583663
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Suggested Courses

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question