Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-04-2004, 12:37 AM   #1 (permalink)
fdtoo
Registered User
 
Join Date: Aug 2004
Posts: 4
fdtoo is on a distinguished road
SQL- Calculated Field

Example:

Date | ItemCode | Stock_In_qty | Stock_Out_qty | Bal_qty
------------------------------------------------------------------

12/09/2003 | A100 | 20 | 0 | 20
25/10/2003 | A100 | 0 | 10 | *10

I need to query an Access database that will take field 3 (Stock_In_qty) plus any bal from
the above row in the calculated field (Bal_qty) minus field 4 (Stock_Out_qty) that will show me
the latest Bal_qty, note that Bal_qty = (Stock_In_Qty - Stock_Out_Qty) AS Bal_Qty.As an Example in the above scenario,
the Bal_qty in the second row on 25/10/2003 is (0 + 20(Row 1) - 10) = *10.Stock out not necessary comes from
Stock In, it could simply be taken out from the Bal_qty balance from previous month, any clues?

can anyone help? Thanks
Fromebbie Mcnight
e-mail:dcartford@yahoo.ca

Q2


I need some expert to help me with this Access SQL Syntax as
there is an error message that says"At most one record can be returned by this subquery"
I think it means that only one result can be return on a subquery, but I need to display
individual ItemCode Qty that are > 30 days old from the Purchase_Date

my synatx are:

"Select distinct ItemCode,Purchase_Date, (SELECT Qty FROM Access_Table WHERE Purchase_Date <Now()-30 And Purchase_Date >Now()-60 AND ItemCode = Main.ItemCode) AS > 30DYS FROM Access_Table AS Main;"


My Query result should look something like this:

Purchase_Date ItemCode > 30 DYS | > 60 DYS | Total
01/06/2004 A100 0 | 15 | 15 |
02/07/2004 A100 20 | 0 | 20 |
12/06/2004 B100 0 | 10 | 10 |
--------------------------------
20 | 25 | 45 |
================================
can anyone help? Thanks
Fromebbie Mcnight
e-mail:dcartford@yahoo.ca
fdtoo is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to generate Calculated Field fdtoo MS Technologies ( ASP, VB, C#, .NET ) 1 09-16-2004 10:13 PM
SQL Forum Belisarius Feedback 2 06-14-2004 06:16 AM
SQL Server Worm -- Is It Just Me.... technobard Lounge 6 01-30-2003 02:53 PM
loading sql schema from php sde PHP 7 12-11-2002 06:57 PM


All times are GMT -8. The time now is 06:39 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting