我有一个数据库查询,如下所示
SELECT f.forum_id,
t.topic_id,
MAX(p.post_id) AS `maxpostid`,
p.admin_user_id,
p.user_id,
t2.topicscount,
SUM(Maxp.postcount) AS postscount,
CONCAT(au.firstname,' ',au.lastname) AS adminname,
fu.nick_name AS nickname,
CONCAT(ce1.value,' ',ce2.value) AS fulln
我需要在magneto中执行以下查询,它是工作查询。
SELECT *
FROM `subscribers-members-old`
WHERE `ZIP` LIKE '9%'
ORDER BY
CASE WHEN `ZIP` = '9305' THEN 1
WHEN `ZIP` LIKE '9%' THEN 2 ELSE 3 END
但是我不确定如何在magento集合中添加条件时的情况,您可以请任何人帮助我解决这个问题。
目前我的magento查询是
$collections = Mage::getModel(
使用Magento1.9.x,我尝试用AND/OR语句创建ORM查询,其结果应该如下所示:
select a.*
FROM main_table a
where (a.updated is not null
a.updated BETWEEN '2012-11-01' AND '2012-12-01')
OR (a.updated is null
AND p.created_at BETWEEN '2012-11-01' and '2012-12-01
我是马根托的新手。我只想构建一个查询,但我很难做到。
我的mysql查询:
SELECT `main_table`.*, `t1`.*, count(t2.review_id) AS `totalrecord`, SUM(t2.rating) AS `totalrating`, `t2`.* FROM `nbmp_vendor` AS `main_table`
LEFT JOIN `customer_entity` AS `t1` ON main_table.customer_id = t1.entity_id
LEFT JOIN `nbmp_review` AS `t2` O
我在我的网格里有这个代码。我正在尝试从order和order_address中检索一些字段。我将为我的join生成这个sQL查询:
SELECT `main_table`.`region`, `main_table`.`city`, `order`.* FROM `sales_flat_order_address` AS `main_table` LEFT JOIN `` AS `order` ON order.entity_id = main_table.parent_id WHERE (address_type = 'shipping') AND (region =
我使用的主题是“爱时尚”的马根托,但这只是为了信息,如果有人遇到了同样的问题与此主题之前。
我得到以下错误Notice: Undefined variable: deal。错误发生在两行,第50行和第61行-但是错误在第50行出现了两次,例如:
Notice: Undefined variable: deal on line 50
Notice: Undefined variable: deal on line 50
Notice: Undefined variable: deal on line 61
这发生在以下代码(从第49行开始,以第67行结束):
public function ad
我的SQL查询语句如下:
SELECT * FROM `sales_flat_order_grid` AS `main_table`
LEFT JOIN (SELECT * from `customer_address_entity_varchar`
WHERE attribute_id=31) AS `ce3`
ON main_table.customer_id=ce3.entity_id
我需要把它翻译成Magento风格。我试过了
$collection = Mage::getResourceModel('sales/order_grid_collection');
在我的magento商店中,我试图从DB表中检索youtube视频列表,有些视频是重复的。
我希望通过使用不同的视频“值”来过滤视频,但不能使用seam来查找有关使用addFieldToFilter()的不同视频的任何信息。
// get video collection
$collection = Mage::getModel('video/video')->getCollection();
$collection->addFieldToFilter('provider', 'youtube');
// filter by vi
我需要在我的查询中建立一个连接表。我需要做一个按"entity_id“类别排序的所有产品的循环,并加入此选择,如果是有效的
SELECT *,
pps_product_id,
MIN(pps_last_unit_price) AS pps_last_unit_price,
pps_quantity_product
FROM
".Mage::getSingleton('core/resource')->getTableName('purchase_product_supplier')."