how to select two columns from two tables in mysql

后端 未结 3 1577
长情又很酷
长情又很酷 2021-01-16 23:44

I am trying to execute this query but i got error \" Undefined index: lname\".I want to count row from one column(fname) from table a and select column(ln

3条回答
  •  执笔经年
    2021-01-17 00:10

    Try this code:

    $result = mysql_query("SELECT COUNT(a.fname) as fname,b.lname as lname FROM a,b");
    while ($row = mysql_fetch_array($result))
    {
      echo "";
      echo $row['lname'];
      echo "";
      echo "";
      echo $row['COUNT(fname)'];
      echo "";
    }
    

提交回复
热议问题