I have a question about the sql left join. Why are all null values found instead of no data?
domain is the domain name table, domain_sell is the listed domain name table, domain_auction_history is the domain name auction table
This is my query statement:
SELECT d.,s.,MAX(h.price) AS max_price FROM domain d LEFT JOIN domain_sell s USING(domain_id) LEFT JOIN domain_auction_history h USING(domain_id) WHERE d.status IN('已上架', '拍卖中') AND s.type='在线拍卖' ORDER BY max_price DESC LIMIT 16
This is the result (there should be no data):
Reply Content:
domain is the domain name table, domain_sell is the listed domain name table, domain_auction_history is the domain name auction table
This is my query statement:
SELECT d.,s.,MAX(h.price) AS max_price FROM domain d LEFT JOIN domain_sell s USING(domain_id) LEFT JOIN domain_auction_history h USING(domain_id) WHERE d.status IN('已上架', '拍卖中') AND s.type='在线拍卖' ORDER BY max_price DESC LIMIT 16
This is the result (there should be no data):
You can refer to the article I briefly compiled about SQL connections
http://www.xumenger.com/sql-j...
I guess you are using phpmyadmin. When queried in this way, it will be empty
There is no data, but the client will display it like this. When you search for an id that does not exist in the domain table and view it on the client, it will also return one row of field names and one row of NULL
This should mean that there is no data. This is also the case when I use Navicat for mysql to query and there are no records that meet the conditions.
The above is a question about the sql left join. Why are all nulls found instead of no data? For more related content, please pay attention to the PHP Chinese website (www.php.cn)!