magento 的一些Sql查询
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查询的更多相关文章
- SQL常见优化Sql查询性能的方法有哪些?
常见优化Sql查询性能的方法有哪些? 1.查询条件减少使用函数,避免全表扫描 2.减少不必要的表连接 3.有些数据操作的业务逻辑可以放到应用层进行实现 4.可以使用with as 5.使用“临时表”暂 ...
- 记一个简单的sql查询
在我们做各类统计和各类报表的时候,会有各种各样的查询要求.条件 这篇主要记录一个常见的统计查询 要求如下: 统计一段时间内,每天注册人数,如果某天没有人注册则显示为0 现在建个简单的表来试试 建表语句 ...
- Oracle常用SQL查询(2)
三.查看数据库的SQL 1 .查看表空间的名称及大小 select t.tablespace_name, round ( sum (bytes / ( 1024 * 1024 )), 0 ) ts ...
- MySQL GROUP_CONCAT函数使用示例:如何用一个SQL查询出一个班级各个学科第N名是谁?
如何用一个SQL查询出一个班级各个学科第N名是谁? 首先贴出建表语句,方便大家本地测试: -- 建表语句 CREATE TABLE score ( id INT NOT NULL auto_incre ...
- SQL查询第m条到第n条的方法
SQL查询第m条到第n条的方法 如表名为GOOD Sselect top (n-m) * from GOODS where (某一列名) not in (select top m (某一列名) fro ...
- Thinkphp查询 1.查询方式 2.表达式查询 3.快捷查询 4.区间查询 5.组合查询 6.统计查询 7.动态查询 8.SQL 查询
1.使用字符串作为条件查询 $user = M('User'); var_dump($user->where('id=1 AND user="蜡笔小新"')->sele ...
- slick for play 使用原生sql查询以及拼接sql
在play中用函数式框架slick来操作数据库是一件很爽的事情.但有时因为某些特殊场景又不得不用原生的sql了. 还好slick支持这种写法,可以看看slick官方文档,Slick Plain SQL ...
- SQL查询每个表的字段数量
--SQL查询每个表的字段数量select b.[name], count(*) As AllCount,ISNULL(ISNULL(sum(case when isnullable=0 then 1 ...
- SQL查询关于相对路径、矢代、绝对路径、递归、计算列的速度对比跟优化-SOD群记录
1秒查原本递归的查询. 适用于:上下级.多层查询 -- Get childs by parent id WITH Tree AS ( SELECT Id,ParentId FROM dbo.Node ...
随机推荐
- KMP字符匹配算法
上个假期就学了KMP,但是基本不用,所以忘干净了...这个的核心思想就是next数组,next数组学名叫最长相同前缀后缀.还不错的算法,KMP 匹配的过程中比原来的暴力匹配多了一个跳来跳去的next. ...
- 10 Future Web Trends 十大未来互联网趋势
转载自:http://blog.sina.com.cn/s/blog_4be577310100ajpb.html 我们很满意自己进入的当前网络纪元,通常被称为Web 2.0.这个阶段互联网的特征包括搜 ...
- Java压缩技术(二) ZIP压缩——Java原生实现
原文:http://snowolf.iteye.com/blog/642298 去年整理了一篇ZLib算法Java实现(Java压缩技术(一) ZLib),一直惦记却没时间补充.今天得空,整理一下ZI ...
- mybatis中if标签判断字符串相等问题
mybatis 映射文件中,if标签判断字符串sfyx变量是否是字符串Y的时候,发现并不管用: <if test="sfyx=='Y' "> and 1=1 </ ...
- 记录一下Junit测试MongoDB,获取MongoTemplate
只是自己记录一下,测试MongoDB帮助类时,没有配置文件的测试 public class HelperTest { MongoTemplate template; @Before public vo ...
- Mysql 时间、字符串、时间戳互转
时间转字符串 select date_format(now(),'%Y-%m-%d'); 时间转时间戳 select UNIX_TIMESTAMP(now()); 时间戳转时间 ) :: 时间戳转字符 ...
- Java算法——求出两个字符串的最长公共字符串
问题:有两个字符串str1和str2,求出两个字符串中最长公共字符串. 例如:“acbbsdef”和"abbsced"的最长公共字符串是“bbs” 算法思路: 1.把两个字符串分别 ...
- jQuery学习笔记之概念(1)
jQuery学习笔记之概念(1) ----------------------学习目录-------------------- 1.概念 2.特点 3.选择器 4.DOM操作 5.事件 6.jQuer ...
- vegas pro 15解决导入的视频和音频有噪声问题,亲测可行
中文步骤: 按住Shift->点击选项->首选项,松开Shift 点击右上角"内部"选项卡,在最下面的搜索栏输入SO4 找到第二项Enable So4 Compound ...
- 三维重建7:Visual SLAM算法笔记
VSLAM研究了几十年,新的东西不是很多,三维重建的VSLAM方法可以用一篇文章总结一下. 此文是一个好的视觉SLAM综述,对视觉SLAM总结比较全面,是SLAM那本书的很好的补充.介绍了基于滤波器的 ...