I have a table of raw sales data which I want to query, so the output can
be imported into Excel and charted. The raw data looks like this, with
one record for each sale:
table 'data'
date size
1/6/04 medium
1/5/04 small
1/6/04 medium
2/6/04 large
3/6/04 medium
3/6/04 large
etc.
What I want to chart is the number of sales for each size on a daily
basis, i.e.
date small medium large
1/6/04 1 2 0
2/6/04 0 0 1
3/6/04 0 1 1
I succeeded in writing a query which can give me the data for one size,
i.e.
SELECT data.DATE, Count (SIZE) AS size total
FROM data
WHERE size = 'small'
GROUP BY data.DATETIME;
which gives me
date small
1/6/04 1
2/6/04 0
3/6/04 0
But I am unable to extend the query to give me all 3 size summaries in
one table.
Any help appreciated.
~richard 1 1242
Hi Richard
TRANSFORM Count(data.Size ) AS AntalOfSize
SELECT data.Date
FROM data
GROUP BY data.Date
PIVOT data.Size;
Regards
Jørn
"richard" <no****@myplace .net> skrev i en meddelelse
news:z6******** *********@news-server.bigpond. net.au... I have a table of raw sales data which I want to query, so the output can be imported into Excel and charted. The raw data looks like this, with one record for each sale:
table 'data'
date size 1/6/04 medium 1/5/04 small 1/6/04 medium 2/6/04 large 3/6/04 medium 3/6/04 large etc.
What I want to chart is the number of sales for each size on a daily basis, i.e.
date small medium large 1/6/04 1 2 0 2/6/04 0 0 1 3/6/04 0 1 1
I succeeded in writing a query which can give me the data for one size, i.e.
SELECT data.DATE, Count (SIZE) AS size total FROM data WHERE size = 'small' GROUP BY data.DATETIME;
which gives me
date small 1/6/04 1 2/6/04 0 3/6/04 0
But I am unable to extend the query to give me all 3 size summaries in one table.
Any help appreciated.
~richard This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sbandy |
last post by:
--=====================_11749194==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed
I am new in mysql....
I wrote this query:
INSERT INTO testo (id_lingua, id_categoria, id_campo, riga, sezione,
ordine, codice) VALUES (10 ,6 ,5 ,"10 - 99:" ,12 ,50 ,'S12IT3' )
and server reply to me:
|
by: Mike Chirico |
last post by:
Hopefully this will help someone...
Helpful Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Last Updated: Fri Apr 16 11:47:34 EDT 2004
The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_mysql.txt?download
Format is better on the above link. I'm looking for suggestions and
|
by: Randell D. |
last post by:
Folks,
I'm working on an ecommerce website that deals with credit card expiry
dates. The table has two columns for year and month. I currently have
a select that says:
(ExpiryDateYear<=$currentYear AND ExpiryDateMonth<=$currentMonth)
Meaning where the card Expiry Date Year column is this year, or older
than this year *AND* where the Expiry Date Month column is this month or
|
by: Dan V. |
last post by:
Situation:
I have to connect with my Windows 2000 server using VS.NET 2003 and C# and
connect to a remote Linux server at another company's office and query their
XML file. Their file may be updated every hour or so. How can I do this
easily? I would like to use secure communication even encryption if
possible. I would query and insert locally only the newest records found in
that XML file to an xml or MS access db.
|
by: Steve |
last post by:
I have a SQL query I'm invoking via VB6 & ADO 2.8, that requires three
"Left Outer Joins" in order to return every transaction for a specific
set of criteria.
Using three "Left Outer Joins" slows the system down considerably.
I've tried creating a temp db, but I can't figure out how to execute
two select commands. (It throws the exception "The column prefix
'tempdb' does not match with a table name or alias name used in the
query.")
| |
by: Melissa Kay Beeline |
last post by:
OK, here's the sitch : we have an access control system at work that
registers ever entry/exit of every employee. I recently made some
queries in Access so the ppl in HR could make reports (who came in
late, how many ppl were undertimed, etc etc) Now they are not
satisfied (of course) and they want a list of ABSENT employees.
I have the following tables :
PERSONNEL
CARD
|
by: chucher |
last post by:
I´m developing a database in access about invoices that could use to
different kinds of money (US Dollar and Pesos).
I have a form where you can insert the invoices and de items of de
invoice. I can insert all everything right
Also I made a detailInvoice query that show every invoice item with the
invoice information (invoiceNumber, client, kindOfMoney, idItem,
product, qty, unitaryPrice, totalUSD and totalP, totalItem) where total
is...
|
by: blueyonder |
last post by:
The statament below does exactly what I want it to do but I don't understand
why?
In my mind the subquery produces a result set which is a subset of the
handset table which the initial part of the query is then applied to.
However, the 'select all from Sim where it doesn't exists' is the bit I
don't get where what doesn't exist? how is the comparison made? I haven't
specified a parameter etc..
Any help would be much appreciated.
|
by: daicamad |
last post by:
I have this:
SELECT UserInfo.EmpID, UserInfo.FirstName, UserInfo.LastName,
Sum(SoldItems.Commision) AS TotalCommission, Sum(TIP.TipAmt) AS
TotalTip,(SELECT Sum(SoldItems.Commision) AS MyCommission FROM
mytable)
FROM
(SELECT * FROM ((SoldItems INNER JOIN UserInfo ON
SoldItems.EmpID=UserInfo.EmpID) INNER JOIN ON
SoldItems.TransID=Transaction.TransID) INNER JOIN TIP ON
(Transaction.TransID=TIP.TransID) AND (UserInfo.EmpID=TIP.EmpID)
|
by: sara |
last post by:
Hi -
I posted this earlier and didn't get any response. Hopefully someone
can help??
I have a table keeping track of employees' jobs in a location. So,
Store #1 Manager #353, AsstMgr #556
Store #2 Manager #776, AsstMgr #132
etc.
|
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: 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: 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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |