简体   繁体   中英

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

the question is that i want to fetch all the field from different table with inner join and where condition. I tried this query

$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'";

i know the another method is like this

$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'";

this is working ...no problem. but can i used like in above frist *select * * ....format... is this possible in mysqli....please help Thanks in advance for any help.....

You can try:

$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'";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM