SA-MP Forums Archive
How to use MySQL 'IN' Operator? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to use MySQL 'IN' Operator? (/showthread.php?tid=635960)



How to use MySQL 'IN' Operator? - Dokins - 17.06.2017

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?


Re: How to use MySQL 'IN' Operator? - Vince - 17.06.2017

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