OldWest
OldWest

Reputation: 2385

MySQL BETWEEN query w/ BETWEEN ? AND?

Can anyone guide me to or provide how the dual question marks work in a BETWEEN comparison.. I can't get it to work and I can't locate or search these data on the MySQL site and Google - bunches of random results.

Upvotes: 1

Views: 520

Answers (3)

Linus Kleen
Linus Kleen

Reputation: 34632

Guessing here.

You probably encountered a query like

SELECT `foo` FROM `bar` WHERE `datetime` BETWEEN ? AND ?

The question marks are placeholders for the actual values to be queried. Usually, the values are properly escaped prior to being "inserted" in the query in order to prevent SQL injection.

Upvotes: 2

Benoit
Benoit

Reputation: 79185

Your question is not clear for me, but it seems what you want is know what the interrogation marks are for.

It seems that the interrogation marks are placeholders. They are replaced by constants (be it integers or sql-escaped strings) when querying, with a vector of values.

Upvotes: 0

Related Questions