我可以在 Mysqli 中使用具有内部连接的表中选择 * 和 where 条件吗?


can i use select * from table with inner join and where condition in mysqli

问题是我想从具有内部连接和 where 条件的不同表中获取所有字段。我试过这个查询

$nowfire="select *
                from reg_user r
                inner join state s
                on r.state=s.state_id
                inner join country c 
                on r.country= c.country_id
          where email_id='xyz@gmail.com'";

我知道另一种方法是这样的

$nowfire="select r.profile_id, r.email_id,s.state_name, c.city_name
                from reg_user r
                inner join state s
                on r.state=s.state_id
                inner join country c 
                on r.country= c.country_id
           where email_id='xyz@gmail.com'";

这是工作...没关系。但我可以像上面一样使用吗 * 选择 * * ....格式。。。这在 Mysqli 中可能吗?请帮忙提前感谢任何帮助.....

你可以试试:

$nowfire="select r.*,s.state_name, c.city_name
                from reg_user r
                inner join state s
                on r.state=s.state_id
                inner join country c 
                on r.country= c.country_id
          where email_id='xyz@gmail.com'";
$nowfire="select r.*,s.*, c.*
                from reg_user r
                inner join state s
                on r.state=s.state_id
                inner join country c 
                on r.country= c.country_id
          where email_id='xyz@gmail.com'";