Duplicating information with mysql ... - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Databases - MySQL, SQL, Oracle, Access and others

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-13-2011, 06:28 PM   #1 (permalink)
Regular User
 
Join Date: Nov 2008
Posts: 20
Default Duplicating information with mysql ...

Hello:

I am trying to get MAX, MIN and AVG totals along with the basic information for groups of SupplierIDs with mysql. I know there will be duplicate information and that is the intent. Any help would greatly be appreciated.


CREATE TABLE tblSupplier
(
tblSupplier_ID CHAR(3) NOT NULL,
tblSupplier_Name CHAR(4) NOT NULL,
tblSupplier_Model VARCHAR(7)
)
;
//
CREATE TABLE tblPart
(
tblPart_ID CHAR(3) NOT NULL,
tblPart_Type CHAR(8) NOT NULL,
tblPart_Price DECIMAL(6,2)
)
;
//
//
INSERT INTO tblSupplier (tblSupplier_ID,tblSupplier_Name,tblSupplier_Model ) VALUES ('125','Sony','Desktop');
INSERT INTO tblSupplier (tblSupplier_ID,tblSupplier_Name,tblSupplier_Model ) VALUES ('136','Sony','Desktop');
//
INSERT INTO tblPart (tblPart_PartID,tblPart_Type,tblPart_Price) VALUES ('125','DRIVE','500.00');
INSERT INTO tblPart (tblPart_PartID,tblPart_Type,tblPart_Price) VALUES ('125','VIDEO','100.00');
INSERT INTO tblPart (tblPart_PartID,tblPart_Type,tblPart_Price) VALUES ('125','KEYBOARD','63.00');
INSERT INTO tblPart (tblPart_PartID,tblPart_Type,tblPart_Price) VALUES ('136','DRIVE','450.00');
INSERT INTO tblPart (tblPart_PartID,tblPart_Type,tblPart_Price) VALUES ('136','VIDEO','300.00');
//
//
//
Result Fields:
tblSupplier_Name,tblSupplier_ID,tblPart_Type, MAX(tblPart_Price), MIN(tblPart_Price), AVG(tblPart_Price)
Sony-125-DRIVE-500.00-500.00-63.00-221.00
Sony-125-VIDEO-100.00-500.00-63.00-221.00
Sony-125-KEYBOARD-63.00-500.00-63.00-221.00

Sony-136-DRIVE-450.00-450.00-300.00-375.00
Sony-136-VIDEO-300.00-450.00-300.00-375.00
pepe_lepew1962 is offline   Reply With Quote
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:13 AM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting