Extract the two attributes at a time & lt ;? Php & nbsp; include (& quot; conn. php & quot;); $ rs = mysql_query (& quot; SELECTproducts_des_options_values.opt: extract the two attributes at a time
Include ("conn. php ");
$ Rs = mysql_query ("
SELECT products_des_options_values.options_values
FROM products_des_options_values
JOIN products_des_attributes ON products_des_options_values.id = products_des_attributes.products_des_options_values_id
JOIN products ON products. id = products_des_attributes.products_id
Join products_des_options on products_des_options.id = products_des_attributes.products_des_options_id
WHERE product_type = '41' and STATUS! = 'D' and products_des_options.id = 31 and ppcode like '% ACK2804N %'
Order by products_des_options_values.options_values
Union
SELECT products_des_options_values.options_values
FROM products_des_options_values
JOIN products_des_attributes ON products_des_options_values.id = products_des_attributes.products_des_options_values_id
JOIN products ON products. id = products_des_attributes.products_id
Join products_des_options on products_des_options.id = products_des_attributes.products_des_options_id
WHERE product_type = '41' and STATUS! = 'D' and products_des_options.id = 35 and ppcode like '% ACK2804N %'
Order by products_des_options_values.options_values ");
While ($ row = mysql_fetch_array ($ rs) and $ row2 = mysql_fetch_array ($ rs2 ))
{
Echo $ V = "$ row [options_values]
";
Echo $ A = "$ row2 [options_values]
";
Echo $ V * $ ."
";
}
?>
When I run phpmydamin, I always report an error: #1064-You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Select options_values FROM products_des_options_values JOIN products_des_attribu 'at line 2
------ Solution --------------------
Because your table name is long. We recommend that you create an alias for each table during query. Then, the query column and condition are added with an alias.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.