Click here to Skip to main content
16,016,580 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'll appreciate any assistance on this. The scenario;

I have a database table with the following sample records;

data1------------dt2-----data3------data4--------data5------data6
Brewing Plant----2------10000------11/3/2012---1136-------person1@yahoo.com
Brewing Plant----2------10000------11/3/2012---1136-------person1@yahoo.com
Car Plant---------1------5000-------11/3/2012---568--------person1@yahoo.com
Brewing Plant----1------5000-------11/3/2012---568--------person2@yahoo.com
Car Plant---------4------20000------11/3/2012---2272------person2@yahoo.com
Brewing Plant----3------15000------11/3/2012---1704------person3@yahoo.com

This is my requirement:
I want just one notification email each sent to theses various persons with their information, e.g;

Person1 should receive an email like
Data1------------dt2---data5
Brewing Plant----4------2272
Car Plant---------1------568

while Person2 should receive an email like
Data1------------dt2---data5
Brewing Plant----1------568
Car Plant---------4------2272
and so on.

I am using classic ASP and mySQL

Thanks for your anticipated assistance.
Posted

1 solution

SQL
SELECT data1, data16, SUM(dt2), MIN(data5)&&MAX(data5)
FROM records
ORDER BY data6 ASC
GROUP BY data6, data1

Use SUM() for adding all the same data in specific column.
And also, use MIN() & MAX() for determining the minimum and maximum data in a specific column.
ASC is for ascending order.

Hope this will help you!
Thanks and regards!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900