我有2个表名为p_order
和p_customer
。
我必须从相应的字段中获取P_order_no
和P_customer_name
的值
<?php
$wherecat = "`p_order_status` = 'active'";
$catsql =$general->GetRows('*' ,'p_order' ,$wherecat);
$catRes = mysql_num_rows($catsql);
<p><muted></muted><br/>
<a href="#">customer name =</a>order no =<br/>
</p>
?>
答案 0 :(得分:0)
试试这个MySQL查询: -
select P_order_no, P_customer_name from p_customer
inner join p_order on
(P_customer_id = P_order_customer_id && p_order_status = 'active')
答案 1 :(得分:0)
尝试此Illuminate\Database\Eloquent\Collection
查询: -
demo
答案 2 :(得分:0)
要从两个表中检索值,您必须对其使用操作。对于实现连接,至少需要一个公共列。
select p_order.P_order_no, p_customer.P_customer_name from p_customer join p_order on p_customer.customer_id = p_order.customer_id