Drupal 7取相当于

时间:2015-10-02 00:43:07

标签: php drupal drupal-7

https://www.codeenigma.com/community/blog/drupal-7-cheat-sheet-database https://www.drupal.org/update/modules/6/7

我无法绕过Drupal 6的变化 - >> 7。

"SELECT CRS_sales.User, CRS_Goals.*, 
sum(CRS_sales.CompUnits) as CompUnits, 
sum(CRS_sales.KBUnits) as KBUnits, 
sum(CRS_sales.PrinterUnits) as PrinterUnits, 
sum(CRS_sales.MouseUnits) as MouseUnits, 
Count(CRS_sales.Comp) as CompCount
sum(CRS_sales.CompUnits + CRS_sales.KBUnits + CRS_sales.PrinterUnits + CRS_sales.MouseUnits) as UnitsTotal,
FROM CRS_sales 
INNER JOIN CRS_Goals
ON CRS_sales.User=CRS_Goals.User
WHERE date(CRS_sales.Created) = "01/10/2015" GROUP BY CRS_sales.User
order by UnitsTotal DESC";

如何获取存在多行的信息?

感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您可以将此SQL传递给db_query()函数以从数据库中获取数据。

答案 1 :(得分:0)

使用db_query函数,例如

$result = db_query("your sql here");
$data = $result->fetchAll();

如果您的查询使用用户数据,您应该通过Drupal的占位符对其进行清理 https://www.drupal.org/writing-secure-code