Home mysql Sampling in SQL with multiple conditions

Sampling in SQL with multiple conditions

Author

Date

Category

Hello.

Tell me how to make a data sample from a table with several conditions. I now have this:

select name from b_iblock_element where iblock_id = 9 and created_by = ". $ _ request [" UserID "]

I need to add one more condition in the query. Adding one more and at the end did not help.
How to write correctly if you need to check the record of 3, 4 or 5 fields?


Answer 1, Authority 100%

respond to 2 questions immediately. Quotes are required, as in the example I wrote

select `field` from` table` What `field` = 'a' and` field2` = 'b' And `Field3` = '3'

Write also through and. The fact is that newcomers are used to without obligatory pitchers, because In 99% of cases ‘rolling’. Here, take to write as I wrote. I here, for example, when I am writing something long folding the conditions in the array, and already in the request they do implode.

Hopefully explained the

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions