I'm trying to convert a query that runs in Query Analyser (SQL Server 2000) to work in MS Access. This will then help me modify the query further and use it to create reports and such.
This query is not something I'm used to seeing in SQL, but the function is to automatically establish what month we are in and how many days there are supposed to be in this month. Then divide the total accumulated values (which are provided in a table) and divide them by that number to get accurate average values.
I'm pasting the query below. Look forward to your responses. - /* CUSTOMERWISE DEBIT/CREDIT AVERAGE BALANCE */
-
Declare @MaxDay smallint
-
Declare @Month Char(4)
-
Declare @Year Char(4)
-
Declare @sSQL Varchar(1000)
-
Select @Year = C_YYYY, @Month = C_MM from Saved_Input_Periods
-
Select @MaxDay = I_Cal_DaysInPer from period_definition Where Year(D_End_date) = @Year And MOnth(D_End_date) = @Month
-
Select @sSQL = ''
-
Select @sSQL = 'Select [ACCOUNTNUMBER]=C_GLACCNO,[CUSTOMERNAME]=C_Cus_ShortName,'
-
Select @sSQL = @sSQL + '[AVERAGE DR BALANCE]=SUM(M_IDSMonthlyAccDrBal/' + Convert(Varchar(2),@MaxDay ) + '),'
-
Select @sSQL = @sSQL + '[AVERAGE CR BALANCE]=SUM(M_IDSMonthlyAccCrBal/' + Convert(Varchar(2),@MaxDay ) + '),'
-
Select @sSQL = @sSQL + '[AVERAGE BALANCE]=SUM(M_IDSMonthlyAccumBal/' + Convert(Varchar(2),@MaxDay ) + ') from gl_P200612'
-
Select @sSQL = @sSQL + ' WHERE C_CusSubSeg Between 250 and 260'
-
Select @sSQL = @sSQL + ' GROUP BY C_GLACCNO,C_Cus_ShortName'
-
Select @sSQL = @sSQL + ' ORDER BY C_Cus_ShortName'
-
Exec (@sSQL)
3 1896 NeoPa 32,572
Recognized Expert Moderator MVP
I think you need to post some table MetaData for this.
Otherwise it is possible, but very difficult, to decipher what is hapenning.
I think you need to post some table MetaData for this.
Otherwise it is possible, but very difficult, to decipher what is hapenning.
I'm sorry but that just flew right over me. MetaData? If you could elaborate, I might be able to comply.
NeoPa 32,572
Recognized Expert Moderator MVP
Sorry - I normally do post an example with it. I must have been in a rush.
MetaData is the definition of a table. Posting Table/Dataset MetaData - Table Name=tblStudent
-
StudentID; Autonumber; PK
-
Family; String; FK
-
Name; String
-
University; String; FK
-
MaxMark; Numeric
-
MinMark; Numeric
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Massimo Fiorentino |
last post by:
Hello there!
I am a bit of a newbee into the mySQL world and I have a question regarding
switching from one DB to another. I have for a couple of years used a very
simple CMS-system created by myself but now I want to move to textpattern
(http://www.textpattern.com/). Using a mySQL tool called NaviCat, I can
easily create queries regarding porting ID, text data etc. from my old DB
into the textpattern DB (using INNER JOINS it seems). But...
|
by: Kenton Groombridge |
last post by:
Hi,
I previous posted this in a gcc and g++ groups since that is the
compiler I am working with, but I didn't get any response.
Hopefully these are the right groups for this question. I am working
(actually playing) on porting Alien vs Predator to Linux. I am using
the code that is available via CVS from icculus.org.
I recently upgraded my gcc to 3.4.1 and now a portion of the code
doesn't compile. Nothing in the code has changed.
|
by: Jonathan |
last post by:
I have to port a MS Access DB to anotherdatabase engine and I would
like to use MySQL because I am familiar with it and is easy to
integrate with the web and php what is the ned point of my 'quest'.
However there are paramter queries in the access database and I would
really like to keep the access database as a backup as long as I'm in
the progress of moving/porting.
I have taken a look at the ODBC connector (3.51) and have tried a...
|
by: Dave Crypto |
last post by:
Hi there,
SUMMARY:
1) When I use phpadmin to export a large database, the file created on
my local PC never containes all the tables and information. It seems
to max out at about 10mb.
2) Will running mysqldump from command line on a live in-use DB (with
one table containing 350,000 rows) pose any risks and have any large
effect of current use?
|
by: Chris Travers |
last post by:
Hi all;
A few years ago, I set about porting a PHP application from MySQL to
PostgreSQL, after realizing that MySQL wasn't going to be able to handle it.
In order to do this, I built a light, fast database abstraction layer which
conforms to the behavior of the MySQL functions in PHP. This means that a
large amount of porting work could be made simple using this porting layer
if the application was originally used PHP's native MySQL...
| |
by: ssb |
last post by:
Hello,
This may be very elementary, but, need help because I am new to access
programming.
(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and populate a combo box with these names.
(this way, I can display all the EMPLOYEE_NAME values)
(2) In general, can I do additional processing on column values from
|
by: wundrlik |
last post by:
I'm having trouble porting over an old VB6 program to VB Express.
In a nutshell - all I need to do is use a form with a textbox (text entry)
and a drop down list (from a Microsoft Access MDB) and create a set of
directories based on the drop down (ties into a separate table in the MDB)
with the textbox text as the root directory.
any thoughts?
|
by: L. R. Du Broff |
last post by:
I own a small business. Need to track a few hundred pieces of rental
equipment that can be in any of a few dozen locations. I'm an old-time C
language programmer (UNIX environment). If the only tool you know how to
use is a hammer, every problem tends to look like a nail. That said, I
could solve my problem in C, but it's not the right tool. I need to come
into the Windows world, and I need to get this done in Access or
something...
|
by: Zhenhuan Du |
last post by:
Hello!
I was porting some files writing by others in C language.
Due to bad naming ,I found many
typedefs disagreement and macro definition conflicts.
That was really annoying.
My first solutions are :
So for clearance and portability, I want to do following actions.
1)Add a prefix like "CCC_" before every macro definition ,typedef
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |