Reputation: 2149
I want to use OR in the statement below, in the statement below i select in one ID_klant, but i want to select on 2 different id's
try {
$stmt = $pdo->prepare('
SELECT *
FROM inkoop t10
WHERE t10.ID_klant = :ID_klant
AND t10.factuurdatum_timestamp >= :timestamp_start
AND t10.factuurdatum_timestamp < :timestamp_eind
GROUP BY t10.ID_inkoop');
$stmt->bindParam(':ID_klant', $ID_klant, PDO::PARAM_INT);
$stmt->bindParam(':timestamp_start', $begin_jaar, PDO::PARAM_INT);
$stmt->bindParam(':timestamp_eind', $eind_jaar, PDO::PARAM_INT);
$stmt->execute();
}
Upvotes: 2
Views: 45
Reputation: 23892
You can use in
to check if a column has a series of values in it. Here's how you'd use it with placeholders:
WHERE t10.ID_klant in (:ID_klant, :second_placeholder)
Then just bind :second_placeholder
and :ID_klant
.
Upvotes: 2