簡體   English   中英

phpMyadmin 在 sql 查詢中返回 0 行

[英]phpMyadmin returns 0 rows in sql query

這是我的查詢

SELECT * from status_votes where vote = 'like' and status_id = 1 and item_poster = 'LUcase'

它返回 0 行,但是當我查看表時,有與我的查詢匹配的行phpmyadmin 顯示行

請讓我知道我哪里出錯了...

嘗試減少查詢以查看哪個 WHERE 子句導致問題:

一次嘗試以下一行:

SELECT * from status_votes where vote = 'like' and status_id = 1 and item_poster = 'LUcase'
SELECT * from status_votes where vote = 'like' and status_id = 1 and item_poster = 'Lucase'
SELECT * from status_votes where vote = 'like' and item_poster = 'LUcase'
SELECT * from status_votes where status_id = 1 and item_poster = 'LUcase'
SELECT * from status_votes where vote = 'like' 
SELECT * from status_votes where status_id = 1 
SELECT * from status_votes where item_poster = 'LUcase'
SELECT * from status_votes 

找出問題應該不難...

我的假設是,在查看 phpMyAdmin 中的值時,您的數據中可能有前導或尾隨空格不可見。 您能否嘗試在 phpMyAdmin 中編輯一條記錄,看看它是否確實包含空格。

請嘗試運行此查詢:

SELECT *
FROM status_votes
WHERE TRIM(vote) = 'like'
AND status_id = 1
AND TRIM(item_poster) = 'LUcase';

如果這不起作用,你能分享你的表結構嗎?

嘗試以下查詢:

SELECT * FROM `status_votes`
 WHERE `vote` = 'like'
   AND `status_id` = '1'
   AND `item_poster` = 'LUcase' 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM