我想比较我的分布式数据库和postgresql。所以我需要使用Python在postgresql上模拟多用户SQL操作。
我可以使用
模块吗? WHERE
cat.category_publish='1'
";
$db->setQuery($query);
$row = $db->loadObjectList();
foreach ($row as $value) {
print_r("<br><br>Katname: ".$value->catname."<br><br>\n");
$query = "
SELECT
prod.`name_".$language."` AS prodname,
prod.product_id AS product_id
FROM
`#__jshopping_products` AS prod
LEFT JOIN
`#__jshopping_products_to_categories` AS pr_cat
ON
pr_cat.product_id = prod.product_id
WHERE
prod.product_publish='1'
AND
pr_cat.category_id = ".$value->category_id."
";
$db->setQuery($query);
$row = $db->loadObjectList();
foreach ($row as $value) {
print_r("Produkte: ".$value->prodname."<br>\n");
}
这是我的代码
WHERE
cat.category_publish='1'
";
$db->setQuery($query);
$row = $db->loadObjectList();
foreach ($row as $value) {
print_r("<br><br>Katname: ".$value->catname."<br><br>\n");
$query = "
SELECT
prod.`name_".$language."` AS prodname,
prod.product_id AS product_id
FROM
`#__jshopping_products` AS prod
LEFT JOIN
`#__jshopping_products_to_categories` AS pr_cat
ON
pr_cat.product_id = prod.product_id
WHERE
prod.product_publish='1'
AND
pr_cat.category_id = ".$value->category_id."
";
$db->setQuery($query);
$row = $db->loadObjectList();
foreach ($row as $value) {
print_r("Produkte: ".$value->prodname."<br>\n");
}
但我不知道它是否正确?如果我想在我的SQL语句中创建随机参数,我该怎么办?
答案 0 :(得分:1)
您可以使用random
函数生成随机的'ST_MAKEENVELOPE`限定符,假设它们属于某个范围。然后使用random函数获取5个不同的ST_MAKEENVELOPE ID。
另一件事你可以使用for cmd in range(5):
而不是创建列表然后再使用它。