MySQL Forums
Forum List  »  General

how to split 1 column in ti many columns
Posted by: dhanapal s
Date: February 18, 2005 10:22PM

1.
----------------------------
Table structure for orders
----------------------------

orders_id int(11) not null auto_increment, date_purchased datetime , payment_method

varchar(64) not null

001 20050202000000 Cash on Delivery
002 20050202000000 Cash on Delivery
003 20050202000000 Credit Sales
004 20050205000000 Cash on Delivery
005 20050205000000 Cash on Delivery
006 20050206000000 Credit Sales
007 20050207000000 Cash on Delivery
008 20050207000000 Credit Sales
009 20050209000000 Cash on Delivery
010 20050209000000 Credit Sales
2.
-------------------------------------------------
Table structure for orders_products
--------------------------------------------------

orders_id int(11) not null default '0', products_quantity int(2) not null default '0',

001 54
002 22
003 63
004 84
005 24
006 47
007 44
008 74
009 54
010 27

These are the tables we used.From these 2 tables we have to print like the following

.............

Date Cash on delivery Credit Sales

02/02/2005 74 63
05/02/2005 108 0
06/02/2005 0 47
07/02/2005 44 74
09/02/2005 54 27

In this we print date wise sum of payment metod,
but we have to print sum(products_quantity ) in to two columns 'for cash on delivery' and

'Credit Sales'.
how we use the mysql query ........if anybody know, Advice me .............

--regards, Dhanapal.

Options: ReplyQuote


Subject
Written By
Posted
how to split 1 column in ti many columns
February 18, 2005 10:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.