如何根据主表中的id从另一个表中选择另外两列?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Portfilo</title>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<div class="row menu-items">
<div class="menu-item col-sm-6 col-xs-12">
<div class="clearfix menu-wrapper">
<h4>English asparagus</h4>
<span class="price">$14.95</span>
<div class="dotted-bg"></div>
</div>
<p>pellentesque enim. Aliquam tempor</p>
</div>
<div class="menu-item col-sm-6 col-xs-12">
<div class="clearfix menu-wrapper">
<h4>English asparagus</h4>
<span class="price">$14.95</span>
<div class="dotted-bg"></div>
</div>
<p>pellentesque enim. Aliquam tempor</p>
</div>
<div class="menu-item col-sm-6 col-xs-12">
<div class="clearfix menu-wrapper">
<h4>English asparagus</h4>
<span class="price">$14.95</span>
<div class="dotted-bg"></div>
</div>
<p>pellentesque enim. Aliquam tempor</p>
</div>
<div class="menu-item col-sm-6 col-xs-12">
<div class="clearfix menu-wrapper">
<h4>English asparagus</h4>
<span class="price">$14.95</span>
<div class="dotted-bg"></div>
</div>
<p>pellentesque enim. Aliquam tempor</p>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:1)
使用JOIN:
SELECT * FROM tbl_setup t1
JOIN tbl_speciality t2
ON t1.app_idd = t2.t1_app_id
我不确定,但我认为您不能在MySQL列名中使用“$”而不会在以后遇到问题。
MySQL加入的一个很好的解释:
http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/