i have a small app that reads a forecourt program's database. i want to get the current shift's info from that and display/print it out.

SELECT name, liters, amount FROM salemast ORDER BY name

the above statement was my first idea, but that didn't add them. just got a long list of all sales in alphabetical order. pft.

SELECT name, SUM(liters), SUM(amount) FROM salemast ORDER BY name

the next statement just gave me one name and a total of all the sales. pft again.

what tiny little statement am i missing out here?

Recommended Answers

All 3 Replies

SELECT name, SUM(liters), SUM(amount) FROM salemast GROUP BY name ORDER BY name
commented: GROUP BY "I approve" +10

ahh yes, the group thing. found it on that mysql query browser too.

thanks. i'll go sit in the corner and wear my n00b hat.

crud, i must have edited this twice and posted replies 6 times to this thread. my opera mini is full of crap these days. maybe it's just because i'm using an ericsson?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.