owz 14
New Member
Hi again had some more problems, all help welcome. Access 2000, SQL
My problem is as stated in the title. I want 2 display the highest and lowest priced car sold for this month. This is what I have. - SELECT CarSales.Car_Reg,MAX (Purchased_Price) AS Highest_Sale
-
FROM CarSales
-
WHERE Purchased_Price=(SELECT MIN(Purchased_Price)AS Smallest_Sale
-
FROM CarSales)=
-
(((Month([Date_Of_Purchase]))=IIf(Month(Now())=1,12,Month(Now()))))
-
GROUP BY [CarSales].[Car_Reg] ;
-
Problem with the code is that it displays the highest price 2 the lowest price ordered by date, but they are all in 1 column.
I want it 2 display just the car reg, highest and lowest price all in separate columns.
CarReg Highest Price Lowest Price
cf63gd7 £8,000 £1500
All help welcome.
5 5455 MMcCarthy 14,534
Recognized Expert Moderator MVP
Try this ... -
-
SELECT CarSales.Car_Reg, MAX (Purchased_Price) AS Highest_Sale, MIN(Purchased_Price) AS Smallest_Sale
-
FROM CarSales
-
WHERE (((Month([Date_Of_Purchase]))=IIf(Month(Now())=1,12,Month(Now()))))
-
GROUP BY [CarSales].[Car_Reg] ;
-
owz 14
New Member
thanx very much, i didnt think it was that simple.
MMcCarthy 14,534
Recognized Expert Moderator MVP
thanx very much, i didnt think it was that simple.
No problem.
Mary
NeoPa 32,579
Recognized Expert Moderator MVP - SELECT CarSales.Car_Reg,MAX (Purchased_Price) AS Highest_Sale
-
FROM CarSales
-
WHERE Purchased_Price=(SELECT MIN(Purchased_Price)AS Smallest_Sale
-
FROM CarSales)=
-
(((Month([Date_Of_Purchase]))=IIf(Month(Now())=1,12,Month(Now()))))
-
GROUP BY [CarSales].[Car_Reg] ;
Did you mean to exclude January completely from your query?
MMcCarthy 14,534
Recognized Expert Moderator MVP
Did you mean to exclude January completely from your query?
Ade right it should be: -
WHERE (((Month([Date_Of_Purchase]))=IIf(Month(Now())=1,12,Month(Now())-1)))
Mary
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steven |
last post by:
Hi there,
I have a list of values that I am displaying in a table (Not using a loop)
I want to be able to put a graphic next to the item with the hightest price.
I have all of the prices in a table.
Any ideas?
|
by: |
last post by:
Does anyone know an easy way to put a current gold price on your own
website? I've seen the graphic methods that Kitco.com offers, but I'd
rather have it pull the value from some gold market system in text format.
I found a website that's doing it, but don't know where to start in reverse
engineering the code:
http://www.goldinvestment.com/Purchasing/Scrap_Gold.asp
Thanks
|
by: Frederick Gotham |
last post by:
Anyone want to give me a hand to write efficient algorithms for Highest
Common Factor and Lowest Common Multiple? This is what I have so far...
Caveat: I haven't gone over the following code in detail, so there might be
a subtle bug lurking somewhere.
unsigned HCF(unsigned const a, unsigned const b)
{
unsigned bigger,smaller;
|
by: rhitz1218 |
last post by:
Hi,
I'm trying to create a function that will sort a number's digits
from highest to lowest.
For example
1000 - will become 0001
or 1234 to 4321
|
by: td0g03 |
last post by:
Hello again guys. I have a question. I'm working on a program for my class and I'm stuck on how to find the lowest and highest number of a user input. We aren't at arrays yet so that's out of the question, but what would be another way of finding the highest and lowest. I remember hearing something in the lines of "cout <<" in class, but forgot. Also I could try the if else statement, but would seem like alot of work. I hope I am making this...
| |
by: gizelle2101 |
last post by:
I've read the articles, but nothing is working. My database just lists jewelry by type and gems. I want to pull out the most expensive piece and the least expensive piece in one query.
<code>
mysql> SELECT type, gems, cost FROM inventory WHERE price=(SELECT MAX(cost) FROM inventory); </code>
This gets me the most expensive piece. When I try adding:
<code>
AND price=(SELECT MIN(cost) FROM inventory);</code>
I just get an error...
|
by: 1 |
last post by:
Dear friend, we sell all kinds of laptops and guitars . our product
is a quantity best, the price is the lowest in the world, i think you
will be interested in our product . thanks a lot! Our Website:http://
www.prs-123.com/
Msn: prs_cool_123@hotmail.com
mail: prs_cool_123@yahoo.com.cn
thanks for everyone good luck with everyone .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Dear friend, we sell all kinds of laptops and...
|
by: lionelm |
last post by:
Item (upc, title, type, category, company, year, sellPrice)
Purchase (receiptId, date, cid, name, card#, expire, expectedDate, deliveredDate)
PurchaseItem (receiptId, upc, quantity)
Stored (name, upc, stock)
To show top selling item: The user provides a date and a number, say n. The system prints a list of the n best selling items on that day, by all the stores. For each best seller, the system shows the title, the company, the current...
|
by: Patrick Fisher |
last post by:
Hi
I have tables from 12 suppliers each of whom can supply the same part,
I need to be able to create a table or query containing a list of
suppliers who can supply at the lowest price for each item. I am
struggling with this, can anyone help.
Thanks
Patrick
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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: 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: 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: 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
| |