duancong2160 2013-08-25 05:30
浏览 71

从多个表中选择

I am trying to select all rows from multiple tables(20 tables) but it isn't working for me, can some show me to select the first two? The tables have duplicate column names if that matters. I have read the manual and it says I can use JOIN but I couldn't get it.

What I tried:

stmt = $mysqli->prepare("SELECT * FROM table1, table2 where firstname LIKE ? ORDER BY id desc");
stmt->bind_param('s', $fname);
stmt->execute();
  • 写回答

3条回答 默认 最新

  • doujiu7680 2013-08-25 05:32
    关注

    Joins are like so:

    SELECT `something` FROM `table1` t1 JOIN `table2` t2 ON joinitem.t1 = joinitem.t2 ...
                                      ^--------table 1's id---------- ^    ^--column name
    
    评论

报告相同问题?