简体   繁体   English

连接两个表结果在 MySql 中显示为空白

[英]Join Two table result comes as Blank in MySql

my problem is when i going to join two table altogather i ran into the problem with one table has data another table has no data but i want to display if data has one table it should display with another table blank .我的问题是,当我要合并两个表时,我遇到了一个问题,一个表有数据,另一个表没有数据,但我想显示如果数据有一个表,它应该与另一个表空白一起显示。 below query i tired but it is getting blank.下面的查询我累了,但它变得空白。

SELECT seats.busno, seats.seats, busbook.customer,busbook.mobile,seats.date 
FROM seats 
INNER JOIN busbook ON seats.busno=busbook.busno

if you want also not matching values you should use left join如果您也不想匹配值,则应使用左连接

SELECT seats.busno, seats.seats, busbook.customer,busbook.mobile,seats.date 
FROM seats 
LEFT JOIN busbook ON seats.busno=busbook.busno

INNER仅在表之间至少有 1 个匹配时才起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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