I'm extracting some data on the hand of MS query, out of an SQL server and put it in a pivot table ...
I found a threat about this in this forum,
but I've got a problem with it ...
If I put this command :
convert(varchar (4);year(HARP_T OT.D_FACT_YM))+ '-'+convert(varch ar(2);month(HAR P_TOT.D_FACT_YM ))
The results are like this : 2005-11, 2005-12, 2005-1, 2005-2, ...
Next, I have to put the data in a pivot table
and the months are not in the right order ...
It would have to be displayed like this : 2005-01, 2005-02, ... , 2005-10, ...
Has somebody any suggestions ? :confused:
5 3650 MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this code.
Format([HARP_TOT.D_FACT _YM],"yyyy-mm")
This will return a String Value in the specified format. It is the only way I know of to assert the trailing 0 in the Month.
I'm extracting some data on the hand of MS query, out of an SQL server and put it in a pivot table ...
I found a threat about this in this forum,
but I've got a problem with it ...
If I put this command :
convert(varchar (4);year(HARP_T OT.D_FACT_YM))+ '-'+convert(varch ar(2);month(HAR P_TOT.D_FACT_YM ))
The results are like this : 2005-11, 2005-12, 2005-1, 2005-2, ...
Next, I have to put the data in a pivot table
and the months are not in the right order ...
It would have to be displayed like this : 2005-01, 2005-02, ... , 2005-10, ...
Has somebody any suggestions ? :confused:
I thank you very much and will try further on monday ...
At first sight, MS Query doesn't allow me to use this expression,
but I think that I don't put the expression at the right place ...
Thank you very much for the help indeed !!
Today, I tried the suggestion I received.
I had another error message like :
"parameters are not allowed for this query"
Thank you anyway ... but if someone has any other suggestion,
it would be a pleasure for me to try it out ;)
Does the year have to be ahead of the month? Try changing it around.
convert(varchar (2);month(HARP_ TOT.D_FACT_YM)) +'-'+convert(varch ar(4);year(HARP _TOT.D_FACT_YM) )
comteck
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Bob |
last post by:
Hi there,
Need a little help with a certain query that's causing a lot of acid
in my stomach...
Have a table that stores sales measures for a given client. The sales
measures are stored per year and there could be multiple sales
measures every year per client. There is another field called last
update date. If there are multiple sales measures then need to select
the one that's been entered last based on this field. Also, if there
|
by: Scott Morford |
last post by:
I am developing a weed management database for the preserve I work on. One
of the queries I'm working on will allow the user to run a query and see which weed
patches have NOT been treated in the current calendar year.
This query involves two tables. The first contains the static information
about the weed patches. The second contains Treatment information. The
tables look something like this
Static Table fields:
Weed_ID (integer)
|
by: Scott Morford |
last post by:
This is a followup to a question I posed last summer.
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&selm=3f451dd4%240%241095%247f8943f3%40newsreader.visi.com
I'm developing a weed management database to track our weed management
practices in the eventual hope of using some statistical models on the data
to measure outcome\success. The database contains principally two tables. One
table contains static information such as an...
|
by: PMBragg |
last post by:
Thank you everyone that helped me with my DateSerial question. I really do
appreciate it. Now my accountant has told I need to pull the inventory for
just the year I'm depreciating. Is there a way to isolate by my
field, to get the Year I need?
Michael
|
by: Matthew Kramer |
last post by:
How would be the best way to do this in Access?
I have two tables. The first table has all the rows of data. The first
column of this table has a country name, the second has a year and the
third column is the data value.
The second table is just a list of standard years ie. 1980, 1985, 1990,
1995).
Is there a way to arrange a query so that all of the rows in table 1
| |
by: Apple |
last post by:
1. I want to create an autonumber, my requirement is : 2005/0001
(Year/autonumber), which year & autonumber no. both can auto run.
2. I had create a query by making relation to a table & query, but I
can't update record in query or in form. I believe the problem is due
to the source query.
In source query, there is a filter to show the incomplete record
("is null" in delivery date)], but I need to re-use the job no. if the
job is...
|
by: ????? |
last post by:
I have an access query which gets data from a number of different
tables. Although the tables have primary key fields, the order in which
the records are returned means that none of these are in ascending
order in the query result set. I need to include in the query a field
that numbers the records in the order that they are returned. The
numbers must be unique and ascending but do not necessarily have to be
consecutive.
For Example:
|
by: Bernd Hohmann |
last post by:
Dear collegues,
small query problem.
A table (simplified example)...
customer as char(5)
inv_date as date
amount as double
|
by: Jimmy Stewart |
last post by:
Ok, I'm trying to write a query that is starting to wear me down.
What I'm trying to do is create a year end report that gets sent to all of
my customers who meet two criteria. One they are 'Residential' customer AND
they have had business with us during this past year.
My report is based on a query.
The query has two tables associated with it. One is tblClients which
provides client name, account type and the other relevant mailing...
|
by: craigfr |
last post by:
I am making a graph comparing last year's defect data with YTD defect data. Our fiscal year starts Nov.1 and ends Oct.31.
To get the YTD, I started used a simple date serial criteria:
Between DateSerial(Year(Date())-1,11,1) And Date()
This works, but only for 10 months out of the year. If your'e in December, it will calculate the YTD from last year's November to the current December, not the last November.
My solution was to make an...
|
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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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: 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: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |