search

Home  >  Q&A  >  body text

java - 这个sql为什么没加where关键词还多加了一个and ,照样能运行查出数据,没有报错呢?

这样写并没有报错,而且可以查出想要的数据

SELECT
    a.*, b.sj_name,
    c.hy_name
FROM
    qdwyc_dd a
LEFT JOIN qdwyc_hy_sj b ON a.dd_jdr = b.id
JOIN qdwyc_hy_passenger c ON a.dd_xdr = c.id
AND dd_num LIKE '%94%'
迷茫迷茫2888 days ago498

reply all(9)I'll reply

  • PHP中文网

    PHP中文网2017-04-18 10:32:54

    Document
    Differences between on and where filtering in mysql left join

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-18 10:32:54

    Join also supports multiple conditions

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:32:54

    There is the ON keyword, which is equivalent to the where keyword for left outer join query

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-18 10:32:54

    It’s in-depth, I learned it in passing

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:32:54

    table1 left join table2 on + 查询条件. You need to learn more SQL statements, the foundation is not solid enough...

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:32:54

    Correct answer upstairs, the poster needs to read more about the basics

    reply
    0
  • PHPz

    PHPz2017-04-18 10:32:54

    This and is connected with the condition after on, and is one of the conditions associated with the table. Basics............

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 10:32:54

    1. Join on followed by the and condition is the condition used when generating a temporary table. It will return the records in the left table regardless of whether the condition in on is true.

    2. The where condition is the condition for filtering the temporary table after the temporary table is generated. At this time, there is no meaning of left join (the records of the left table must be returned). If the condition is not true, all will be filtered out.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:32:54

    The basic part of SQL language includes inner joins, outer joins, and outer joins are divided into left outer joins, right outer joins, and complete outer joins. You can find it by looking at the basics of SQL language

    reply
    0
  • Cancelreply