MySQL Forums
Forum List  »  Newbie

joined query problem
Posted by: Tivadar Tot
Date: May 12, 2010 05:21AM

Hi,

I got in database table CATEGORY and table PRICE

CREATE TABLE `price_cat` (
`price_cat_id` INT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
`price_cat_name` VARCHAR(255) NOT NULL DEFAULT '',
PRIMARY KEY (`price_cat_id`)
)
ENGINE=MyISAM
ROW_FORMAT=DEFAULT

---------------------------------------------------

CREATE TABLE `price` (
`price_id` INT(6) UNSIGNED NOT NULL AUTO_INCREMENT,
`price_pricecat` INT(6) UNSIGNED NULL DEFAULT NULL, [here comes the category ID the price_cat_id]
`price_name` VARCHAR(255) NOT NULL DEFAULT '',
`price` FLOAT NOT NULL DEFAULT '0',
PRIMARY KEY (`price_id`)
)
ENGINE=MyISAM
ROW_FORMAT=DEFAULT

How can I do the query to get like this:

<!-- query begin
Category 1 [this is the category from 'price_cat' table]
Chinese TV-s 100 dollar [these are from 'price' table]
English TV-s 100 dollar
Hungarian TV-s 100 dollar

Category 2
Chinese radio 100 dollar
Russian radio 100 dollar
Japanese radio 100 dollar

...
query end -->

Thanx in advanced

Options: ReplyQuote


Subject
Written By
Posted
joined query problem
May 12, 2010 05:21AM
May 12, 2010 07:55AM
May 12, 2010 08:08AM
May 12, 2010 08:26AM


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.