How to use MySQL 'IN' Operator?
#1

pawn Code:
format(query, sizeof(query), "SELECT * FROM `arecords` WHERE PSQLID IN(%d, %d, %d)", BSub[playerid][0], BSub[playerid][1], BSub[playerid][2]);
                        mysql_tquery(dbHandle, query, "GetBloodResult", "i",playerid);

How do I get the result from this?

Essentially, I have 3 Blood Sample slots. I'm trying to check in ONE query if those 3 variables (if > 0) are in the police database to match to a record.

What is the correct way?
Reply
#2

The IN operator is essentially a structured OR. Saying
PHP Code:
WHERE id IN(1,3,5
is the same as saying
PHP Code:
WHERE id OR id OR id 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)