473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to minus a number in the same table

I am write a asp.net application, I want to make a report by connect to access database to take out the result. but I don't know how to do. In addition, My English is just a little so I can not describe my idea. please, forgive me, if you don't understand what I describe. :(
My access data have a table such as below:
product Quantity status date/time
P0001 1 In
P0002 3 out
P0003 1 in
P0004 2 in
P0005 4 out
P0006 3 in
P0006 3 out
P0003 3 in
P0001 1 In

I want to calculate the quantity of these products after in and out but I don't know how to find out. I want the result like below:
product quantity
P0001 2
P0002 -3
P0003 4
P0004 2
P0005 -4
P0006 0
Please, help me!
Mar 31 '08 #1
1 1370
Delerna
1,134 Expert 1GB
I am guessing you are asking for the query you need to write in access.

So something like this
Expand|Select|Wrap|Line Numbers
  1. SELECT Product,sum(iif(status="IN",Quantity,Quantity*-1)) as Qty
  2. FROM YourTable
  3. GROUP BY Product
  4.  
Mar 31 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Andrew Ward | last post by:
Hi All, I tried to compile the following line: pair<long, ulong> cr3(make_pair(-2147483648L, 2147483647)); but get this error: unary minus applied to unsigned type, result still unsigned. ...
1
by: Rama S | last post by:
Hi, We need a query which retrieves option_code, for a plan from OPTION table which are unique in (market, "ALL"). I have an example below PLAN MARKET OPTION_CODE RATE...
1
by: Bibic0711 | last post by:
I am having problem on following situation, any comments are welcome. I have this table A which contents most of the data, that needs to be query based on a name field in table B and was linked...
13
by: Marc | last post by:
Hi, I've been lurking on clc for a few months now, and want to start by thanking the regulars here for opening my eyes to a whole new dimension of "knowing c". Considering I had never even...
3
by: Blake | last post by:
Hello, I have a database at work that keeps an inventory of cameras by location. Every week I get a repair estimate sheet that lists cameras by serial number that need to be repaired. This list...
19
by: mantrid | last post by:
I have the following link to bring up an alert with a figure in it based on the screen resolution. but instead of displaying a number 'NaN' is displayed. <a href="javascript:alert('Your ideal...
6
by: Matthew Cook | last post by:
I would like to overload the unary minus operator so that I can negate an instance of a class and pass that instance to a function without creating an explicit temporary variable. Here is an...
6
Robbie
by: Robbie | last post by:
Hi again all, here's something I'm stuck on... I'm making a function to convert a unicode character into the kind of code you need to put on a UTF-8 encoded web page (ampersand, hash, digits,...
1
by: doll | last post by:
hi all I'm using two tables called t1,t2..i need to display the id's that are there in the 1st table but not in the second table..i hope the minus function will give the results..the query i...
2
by: Shalini Bhalla | last post by:
I want to extract records form a table . I have Table A and Table B . I want to extract unmatching records from table A to table B .... Can you Please tell me how to extrat it ? How to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.