我有大约1000条记录,我正在查询和随机排序。每个记录都有一个业务类型,我想通过随机排序,然后是businesstype。这是我的疑问:
$sqlQuery = "SELECT * FROM businesses where postcode REGEXP '^" . $pcode . "[0-9]' and BusinessID NOT IN (SELECT BusinessID FROM telesales.notinterested WHERE NOW() BETWEEN DateOfCall and (DateOfCall + INTERVAL 42 DAY)) ORDER BY RAND() limit 500";
如果我做RAND(), BusinessType
那么它的所有随机性仍然是,如果我在Rand之后按BusinessType尝试分组,它不会给出任何结果。有什么想法吗?