magento ÔÚMagentoÖÐʹÓÃ×Ô¼ºÐ´µÄSQLÓï¾ä
MagentoµÄModels
ºÍCollection
ºÜÇ¿´ó£¬Ê¹ÓÃËüÃÇ¿ÉÒԺܷ½±ãµÄ²éѯºÍ²Ù×÷Êý¾Ý¿â¡£µ«ÊÇÓÐЩ³¡ºÏ£¬ÒòÎªÒ»Ð©ÌØÊâÐèÇó»ò¶ÔMagentoµÄÁ˽ⲻ¹»É¿ÉÄÜ»áÐèÒª×Ô¼ºÊÖдSQLÓï¾äÀ´²éѯºÍ²Ù×÷Êý¾Ý¿â¡£ÒÔÏ·ֱðÊǶÁдÊý¾Ý¿âµÄ´úÂë¡£
// For Read
// fetch read database connection that is used in Mage_Core module
$read= Mage::getSingleton('core/resource')->getConnection('core_read');
$value=$read->query("SE...");
$row = $value->fetch();
print_r($row); // As Array
// For Write
// fetch write database connection that is used in Mage_Core module
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
// now $write is an instance of Zend_Db_Adapter_Abstract
$write->query("insert into tablename values ('aaa','bbb','ccc')");
Ïà¹ØÎĵµ£º
SQL²éѯÓï¾ä¾«»ªÊ¹ÓüòÒª
¡¡¡¡¼òµ¥µÄTransact-SQL²éѯֻ°üÀ¨Ñ¡ÔñÁÐ±í¡¢from×Ó¾äºÍWHERE×Ӿ䡣ËüÃÇ·Ö±ð˵Ã÷Ëù²éѯÁС¢²éѯµÄ±í»òÊÓͼ¡¢ÒÔ¼°ËÑË÷Ìõ¼þµÈ¡£
¡¡¡¡ÀýÈ磬ÏÂÃæµÄÓï¾ä²éѯtesttable±íÖÐÐÕÃûΪ“ÕÅÈý”µÄnickname×ֶκÍemail×ֶΡ£
¡¡¡¡SELECT nickname,email
¡¡¡¡[1] from testtable
¡¡¡¡WHERE nam ......
±¾ÎÄÀ´×Ô£ºhttp://zhidao.baidu.com/question/27978123.html?si=1
ÕâЩÊÇ SQL-92 ÉèÖÃÓï¾ä£¬Ê¹ SQL Server 2000/2005 ×ñ´Ó SQL-92 ¹æÔò¡£
µ± SET QUOTED_IDENTIFIER Ϊ ON ʱ£¬±êʶ·û¿ÉÒÔÓÉË«ÒýºÅ·Ö¸ô£¬¶øÎÄ×Ö±ØÐëÓɵ¥ÒýºÅ·Ö¸ô¡£µ± SET QUOTED_IDENTIFIER Ϊ OFF ʱ£¬±êʶ·û²»¿É¼ÓÒýºÅ£¬ÇÒ±ØÐë·ûºÏËùÓÐ Transact-SQL ±êÊ ......
Student(S#,Sname,Sage,Ssex) ѧÉú±í
Course(C#,Cname,T#) ¿Î³Ì±í
SC(S#,C#,score) ³É¼¨±í
Teacher(T#,Tname) ½Ìʦ±í
ÎÊÌ⣺
1¡¢²éѯ“001”¿Î³Ì±È“002”¿Î³Ì³É¼¨¸ßµÄËùÓÐѧÉúµÄѧºÅ£»
select a.S# from (select s#,score from SC where C#='001') a,(select s#,score
fr ......
¹¦ÄÜ£ºÐ¡Ð´½ð¶îת»»³É´óд
²ÎÊý£º@LowerMoney Сд½ð¶î ¼ÓÉÏСÊýµã×¿ÉÒÔ±£Áô38λ
Êä³ö£º´óд½ð¶î
¼ò½é£ºSQL°æ Сд½ð¶îת»»³É´óд½ð¶î£¨×î¶à¿ÉÒÔ¾«È·µ½Ð¡ÊýµãËÄ룩
×¢£º Decimal Êý¾ÝÀàÐÍ×î¶à¿É´æ´¢ 38 ¸öÊý×Ö
×ªÔØ£ºÇë±£ÁôÒÔÉÏÐÅÏ¢,лл£¡£¡£¡
********************************* ......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Data.OleDb;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace Str
{
public partial class Form1 : F ......