473,322 Members | 1,614 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,322 software developers and data experts.

Query-problem: Compare ArticleYearPrices of 2 years

Dear All,

Table: ArticleYearPrice
ART_ID
YEAR
PRICE

ART_ID YEAR PRICE
111 2006 1,00
111 2007 1,01
I want this list: ParameterQuery: compare [year1] and [year2]

ART_ID PRICE_YEAR1 PRICE_YEAR2 ABS_DIFFERENCE %
DIFFERENCE
111 1,00 1,01
0,1 1 %

Thanks,

Filips
Jul 10 '06 #1
1 1168
Filips Benoit wrote:
Dear All,

Table: ArticleYearPrice
ART_ID
YEAR
PRICE

ART_ID YEAR PRICE
111 2006 1,00
111 2007 1,01
I want this list: ParameterQuery: compare [year1] and [year2]

ART_ID PRICE_YEAR1 PRICE_YEAR2 ABS_DIFFERENCE %
DIFFERENCE
111 1,00 1,01
0,1 1 %
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Untested:

PARAMETERS [Year1] Int, [Year2] Int;
SELECT T1.art_id, T1.price As Year1Price, T2.price As Year2Price,
T2.price - T1.price As AbsDifference,
(T2.price - T1.price)/T2.price As DifferencePct
FROM ArticleYearPrice As T1 INNER JOIN ArticleYearPrice As T2
ON T1.art_id = T2.art_id
WHERE T1.[Year] = [Year1]
AND T2.[Year] = [Year2]

--
MGFoster:::mgf00 <atearthlink <decimal-pointnet
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBRLL3gIechKqOuFEgEQKWaACg5TOQ23WpDXlnXmUR7FuC9w 0hdWwAnAit
aDGKuyylRrB0ei06sWxpmrCW
=ENcP
-----END PGP SIGNATURE-----
Jul 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
5
by: Ryan Hubbard | last post by:
Is it possible to get the recordset from an open query window? So you run the query. The window is open. Can vba retrieve this data?
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
15
by: Richard Hollenbeck | last post by:
I tried to ask this question before on the 14th of January but I never got a reply. I'm still struggling with the problem. I'll try to rephrase the question: I have a crosstab query with rows...
7
by: stig | last post by:
hi. coming from postgresql, i am used to textual references to most of the things i do with the database. i feel a little lost with all the graphical. i have few questions regarding MS SQL 2000...
3
by: cover | last post by:
I have a table with 50 fields that receive input depending on whether that input came in from a 'shaker' form or a 'conveyor' form. Input from the 'conveyor' form might populate 25 fields while...
2
by: John T Ingato | last post by:
If I run a query that calculates the sales data for all the inventory level in a table, how do I go about saving that sales data into a permanent table? I plan I using this sales data often, and...
3
by: diego | last post by:
Greetings everyone! Is there a way to stop query analyzer from processing remaining query statements? Let's say i have the following query in query analyzer: query statements if condition...
4
by: Doris | last post by:
It does not look like my message is posting....if this is a 2nd or 3rd message, please forgive me as I really don't know how this site works. I want to apologize ahead of time for being a novice...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.