1,模拟使用getName()获取产品名称的sql

SELECT `value` AS product_name FROM yo_catalog_product_entity_varchar 

WHERE entity_type_id = (SELECT entity_type_id FROM yo_eav_entity_type WHERE entity_type_code = 'catalog_product') 

AND attribute_id = (SELECT attribute_id FROM yo_eav_attribute WHERE attribute_code = 'name' 

AND entity_type_id = (SELECT entity_type_id FROM yo_eav_entity_type WHERE entity_type_code = 'catalog_product'))

2,Mage::getModel('catalog/product')->getCollection()的sql输出

SELECT  `e` . * ,  `price_index`.`price` ,  `price_index`.`tax_class_id` ,  `price_index`.`final_price` , IF( price_index.tier_price IS NOT NULL , LEAST( price_index.min_price, price_index.tier_price ) , price_index.min_price ) AS  `minimal_price` ,  `price_index`.`min_price` ,  `price_index`.`max_price` , `price_index`.`tier_price`
FROM `yo_catalog_product_entity` AS `e`
INNER JOIN `yo_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id
AND price_index.website_id = ''
AND price_index.customer_group_id = ''
LIMIT 0 , 30

SELECT `e` . * , `price_index`.`price` , `price_index`.`tax_class_id` , `price_index`.`final_price` , IF( price_index.tier_price IS NOT NULL , LEAST(price_index.min_price, price_index.tier_price ) , price_index.min_price ) AS `minimal_price` , `price_index`.`min_price` , `price_index`.`max_price` ,`price_index`.`tier_price` 
FROM `yo_catalog_product_entity` AS `e` 
INNER JOIN `yo_catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id
AND price_index.website_id = '1'
AND price_index.customer_group_id = '4'
LIMIT 0 , 30

magento 的一些Sql查询的更多相关文章

  1. SQL常见优化Sql查询性能的方法有哪些?

    常见优化Sql查询性能的方法有哪些? 1.查询条件减少使用函数,避免全表扫描 2.减少不必要的表连接 3.有些数据操作的业务逻辑可以放到应用层进行实现 4.可以使用with as 5.使用“临时表”暂 ...

  2. 记一个简单的sql查询

    在我们做各类统计和各类报表的时候,会有各种各样的查询要求.条件 这篇主要记录一个常见的统计查询 要求如下: 统计一段时间内,每天注册人数,如果某天没有人注册则显示为0 现在建个简单的表来试试 建表语句 ...

  3. Oracle常用SQL查询(2)

    三.查看数据库的SQL 1 .查看表空间的名称及大小 select  t.tablespace_name,  round ( sum (bytes / ( 1024 * 1024 )), 0 ) ts ...

  4. MySQL GROUP_CONCAT函数使用示例:如何用一个SQL查询出一个班级各个学科第N名是谁?

    如何用一个SQL查询出一个班级各个学科第N名是谁? 首先贴出建表语句,方便大家本地测试: -- 建表语句 CREATE TABLE score ( id INT NOT NULL auto_incre ...

  5. SQL查询第m条到第n条的方法

    SQL查询第m条到第n条的方法 如表名为GOOD Sselect top (n-m) * from GOODS where (某一列名) not in (select top m (某一列名) fro ...

  6. Thinkphp查询 1.查询方式 2.表达式查询 3.快捷查询 4.区间查询 5.组合查询 6.统计查询 7.动态查询 8.SQL 查询

    1.使用字符串作为条件查询 $user = M('User'); var_dump($user->where('id=1 AND user="蜡笔小新"')->sele ...

  7. slick for play 使用原生sql查询以及拼接sql

    在play中用函数式框架slick来操作数据库是一件很爽的事情.但有时因为某些特殊场景又不得不用原生的sql了. 还好slick支持这种写法,可以看看slick官方文档,Slick Plain SQL ...

  8. SQL查询每个表的字段数量

    --SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 ...

  9. SQL查询关于相对路径、矢代、绝对路径、递归、计算列的速度对比跟优化-SOD群记录

    1秒查原本递归的查询. 适用于:上下级.多层查询 -- Get childs by parent id WITH Tree AS ( SELECT Id,ParentId FROM dbo.Node ...

随机推荐

  1. Microsoft ASP.NET SignalR

    SignalR类似与JavaScript实时框架,如Socket.IO.SignalR能够完成客户端向服务器的异步通信,并同时支持服务器向浏览器客户端推送事件.SignalR的连接通过日益流行的Web ...

  2. Appium + python - 监控appium server start

    import osimport time as t def start_appium(port = 4723,udid="4871660c"): a = os.popen(&quo ...

  3. Django day07 (二)单表操作

    单表操作 -mysql数据库:settings里配置: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME ...

  4. python 7:del 列表指定元素、list.pop(索引)、list.remove(元素值)(删除列表指定元素,且不可再使用;默认索引-1,弹出指定列表元素,可再使用;移除列表指定第一个元素)

    bicycles = ['trek', 'cannondale', 'redline', 'specialized'] print(bicycles) del bicycles[0] #删除指定列表元 ...

  5. 生成jsp验证码的代码详解(servlet版)

    package util; import java.util.*; import java.io.*; import java.awt.*; import java.awt.image.*; impo ...

  6. javascript中执行环境和作用域(js高程)

    执行环境(execution context,为简单起见,有时也成为“环境”)是javascript中最为重要的一个概念.执行环境定义了变量或函数有权访问的其他数据,决定了它们各自的行为.每个执行环境 ...

  7. js仿新浪游戏频道导航条

    js仿新浪游戏频道导航条 在线演示本地下载

  8. spring data jpa 、hibernate、jpa之间的关系

    引用:http://blog.csdn.net/u014421556/article/details/52635000 hibernate作为JPA的实现.   JPA规范与ORM框架之间的关系   ...

  9. 努比亚(nubia) M2青春版 NX573J 解锁BootLoader 并进入临时recovery ROOT

    努比亚(nubia) M2青春版 NX573J 解锁BootLoader 并进入临时recovery ROOT 工具下载链接:https://pan.baidu.com/s/1NfRTdXtdAZRi ...

  10. 分类(Category)的本质 及其与类扩展(Extension) /继承(Inherit)的区别

    1.分类的概念 分类是为了扩展系统类的方法而产生的一种方式,其作用就是在不修改原有类的基础上,为一个类扩展方法,最主要的是可以给系统类扩展我们自己定义的方法. 如何创建一个分类?↓↓ ()Cmd+N, ...