MySQL: fetching a null or an empty string -
I know that a NULL
value and an empty string ( ""
) value, but if I want to get a value using the keyword or
, then I can not find any results for NULL
value
is. I want to ask that the table looks like this:
titles_and_tags + ---- + ---------- + ------ + | ID | Title | Tag | + ---- + ---------- + ------ + | 1 | Title 1 Faucet | 2 | Heading 2 | Tag 1 | | 3 | Title 3 Tag 2 | | 4 | Edit | Faucet | 5 | Roudata | Div | + ---- + ---------- + ------ +
The use of my query looks like this:
Select * by selecting the name "and" Tag "=" Tag 1 "or" Tag ") * Select * by name
So I get one here Do the rows (id: 1,2), but this result is 0 rows. What have I done?
Edit
Sorry, I Forgotten that my main problem is:
select 'Titles_and_tags` from WHERE' title 'such as "title%" and "tag` =" tag1 " '%' Like 'tag'
then it is more like a closed subject, sorry
Try
heading * and tags with the title 'WHERE' *
You have a wildcard % < Except "code" and left your
"" "heading"% "and (` tag` = "tag1" or "tags" such as
, and you enter or
should be included in the clause for clarity and clearly to ensure that it is fair with your intention Have been committed, group together logic together.
Edit: Your edit will match the tag '%' such as
all the rows that do not have the tag null
. A null
value is incorrect with any or is not
other than I'm not sure that you What are you trying to do with the last question, but I suspect that the question you asked for was originally what you really want.
Comments
Post a Comment