Reputation: 664
I have really simple SQL which howevere returns 0 rows:
SQL:
SELECT `article_id`, `article_title`, `article_url`, `article_text`,
article_img`, `article_shares`, `article_likes`, `article_date`,
(SELECT COUNT(comment_id) FROM ci_comments WHERE comment_aid=article_id)
AS commentCount
FROM (`ci_articles`)
WHERE `article_url` = 'Jednym-slovom2'
SQL Table:
Any help is appreciated
Upvotes: 0
Views: 51
Reputation: 3456
Try to copy the text out of the table and into your where clause. That will pull out spaces and weird characters.
Upvotes: 1
Reputation: 9489
Is your column article_url
a padded column? If it always has 15 characters, then you might have whitespace at the end of the data that is less than 15 characters, ie 'Jednym-slovom2' might actually be 'Jednym-slovom2 '. The MS Sql Server datatype NCHAR will have columns like this. To solve this problem, just use text wildcards on your search like '%Jednym-slovom2%'
Upvotes: 1