table_1:
product_id features .
1aaa
2bbb
3ccc
table_2 :
product_idname sizeprice
1 111 111
1 12 2 221
1 13
- Original Message -
From: Brent Baisley brentt...@gmail.com
To: Jose Julian Buda jb...@noticiasargentinas.com
Sent: Thursday, February 12, 2009 1:21 PM
Subject: Re: How can avoid 2 selects and 2 while?
On Thu, Feb 12, 2009 at 10:43 AM, Jose Julian Buda
jb...@noticiasargentinas.com
...@noticiasargentinas.com
To: mysql@lists.mysql.com
Subject: Re: How can avoid 2 selects and 2 while? SOLVED
Date: Thu, 12 Feb 2009 13:45:13 -0300
- Original Message -
From: Brent Baisley brentt...@gmail.com
To: Jose Julian Buda jb...@noticiasargentinas.com
Sent: Thursday, February 12, 2009 1:21 PM
I would do the following:
SELECT t1.features, t2.name, t2.size, t2.price
FROM table_2 as t2 LEFT JOIN table_1 as t1 ON t2.product_id = t1.product_id
Then in (psuedo) PHP:
$prev_features = ;
foreach($result as $row){
if ($row['features'] != $prev_features) {
echo ''Product features: .