0

Full code I use:

 $query18 = 'SELECT group_concat(id) as qc10 FROM tblorders WHERE date LIKE \'' . date ('Y-m-') . '%\'';
    $result18 = mysql_query($query18);
    $data18 = mysql_fetch_array($result18);
    $qc10 = $data18['qc10'];
  $query19 = "SELECT count(id) as qc11 FROM bl_orderitems WHERE orderid=$qc10";
    $result19 = mysql_query($query19);
    $data19 = mysql_fetch_array($result19);

$query19 looks like this:

'SELECT count(id) FROM bl_orderitems WHERE orderid=7,6,8,9,10,11,12,13,14';

But it doesn't work. How can I list those ID's so it would actually work?

THANKS!

3 Answers 3

5

use WHERE orderid IN(7,6,8,9,10,11,12,13,14)

so the query would be:

'SELECT count(id) FROM bl_orderitems WHERE orderid IN(7,6,8,9,10,11,12,13,14)';
Sign up to request clarification or add additional context in comments.

Comments

3

Try using IN

SELECT count(id) FROM bl_orderitems WHERE orderid IN (7,6,8,9,10,11,12,13,14)

Comments

2

If you are looking to match a value for orderid that is one of those options that you listed, this should work:

SELECT count(orderid) FROM bl_orderitems WHERE orderid IN (7,6,8,9,10,11,12,13,14);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.