<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The Magento Expert</title>
	<atom:link href="http://www.the-mage-expert.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-mage-expert.com</link>
	<description>Your Magento Commerce Expert</description>
	<lastBuildDate>Tue, 24 Jan 2023 09:37:24 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.6</generator>
	<item>
		<title>Deleting all products using SQL</title>
		<link>http://www.the-mage-expert.com/1045/magento-deleting-all-products-using-sql/</link>
		<comments>http://www.the-mage-expert.com/1045/magento-deleting-all-products-using-sql/#comments</comments>
		<pubDate>Thu, 10 Mar 2016 10:08:01 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[product]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=1045</guid>
		<description><![CDATA[To delete all product related data, use the following query: [crayon-69f5b379e1cda/] Due to the constraints it will delete all related data from other tables as well.]]></description>
				<content:encoded><![CDATA[<p>To delete all product related data, use the following query:</p>
<p></p><pre class="crayon-plain-tag">DELETE FROM catalog_product_entity;</pre><p></p>
<p>Due to the constraints it will delete all related data from other tables as well. </p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/1045/magento-deleting-all-products-using-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting products with or without custom options using SQL</title>
		<link>http://www.the-mage-expert.com/1005/magento-getting-products-with-or-without-custom-options-using-sql/</link>
		<comments>http://www.the-mage-expert.com/1005/magento-getting-products-with-or-without-custom-options-using-sql/#comments</comments>
		<pubDate>Fri, 15 Jan 2016 01:22:07 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[custom options]]></category>
		<category><![CDATA[product]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=1005</guid>
		<description><![CDATA[To get all products that do not have custom options, simply run the following SQL query: [crayon-69f5b379eb0df/] To get all products that do have custom options, remove the &#8220;NOT&#8221; from the above query.]]></description>
				<content:encoded><![CDATA[<p>To get all products that <strong>do not</strong> have custom options, simply run the following SQL query: </p>
<p></p><pre class="crayon-plain-tag">SELECT
  *
FROM catalog_product_entity
WHERE entity_id NOT IN (SELECT DISTINCT
    product_id
  FROM catalog_product_option);</pre><p></p>
<p>To get all products that do have custom options, remove the &#8220;NOT&#8221; from the above query.</p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/1005/magento-getting-products-with-or-without-custom-options-using-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving the &#8220;Invalid backend model specified: catalog/attribute_backend_customlayoutupdate&#8221; problem</title>
		<link>http://www.the-mage-expert.com/947/magento-solving-invalid-backend-model-specified-problem/</link>
		<comments>http://www.the-mage-expert.com/947/magento-solving-invalid-backend-model-specified-problem/#comments</comments>
		<pubDate>Thu, 08 Jan 2015 13:06:54 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=947</guid>
		<description><![CDATA[Run the following query: [crayon-69f5b379eb45b/] Remember the attribute_ids from that query and run the following query: [crayon-69f5b379eb4a6/] Done!]]></description>
				<content:encoded><![CDATA[<p>Run the following query:</p>
<p></p><pre class="crayon-plain-tag">SELECT
  *
FROM eav_attribute
WHERE (
`attribute_id` LIKE '%stomlayoutupdate%'
OR `entity_type_id` LIKE '%stomlayoutupdate%'
OR `attribute_code` LIKE '%stomlayoutupdate%'
OR `attribute_model` LIKE '%stomlayoutupdate%'
OR `backend_model` LIKE '%stomlayoutupdate%'
OR `backend_type` LIKE '%stomlayoutupdate%'
OR `backend_table` LIKE '%stomlayoutupdate%'
OR `frontend_model` LIKE '%stomlayoutupdate%'
OR `frontend_input` LIKE '%stomlayoutupdate%'
OR `frontend_label` LIKE '%stomlayoutupdate%'
OR `frontend_class` LIKE '%stomlayoutupdate%'
OR `source_model` LIKE '%stomlayoutupdate%'
OR `is_required` LIKE '%stomlayoutupdate%'
OR `is_user_defined` LIKE '%stomlayoutupdate%'
OR `default_value` LIKE '%stomlayoutupdate%'
OR `is_unique` LIKE '%stomlayoutupdate%'
OR `note` LIKE '%stomlayoutupdate%'
);</pre><p></p>
<p>Remember the attribute_ids from that query and run the following query:</p>
<p></p><pre class="crayon-plain-tag">DELETE
  FROM eav_attribute
WHERE attribute_id IN (attribute_ids from first query);</pre><p></p>
<p>Done!</p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/947/magento-solving-invalid-backend-model-specified-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the status of every product in the database using MySQL</title>
		<link>http://www.the-mage-expert.com/680/magento-getting-status-of-every-product-database-using-mysql/</link>
		<comments>http://www.the-mage-expert.com/680/magento-getting-status-of-every-product-database-using-mysql/#comments</comments>
		<pubDate>Tue, 30 Sep 2014 08:30:17 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=680</guid>
		<description><![CDATA[The following MySQL query returns the status of every product in the Magento database. [crayon-69f5b379eb978/] Status 1: active Status 2: not active]]></description>
				<content:encoded><![CDATA[<p>The following MySQL query returns the status of every product in the Magento database.</p>
<p></p><pre class="crayon-plain-tag">SELECT
  cpe.sku,
  q.product_status
FROM catalog_product_entity cpe
  JOIN (SELECT
    entity_id AS product_id,
    value AS product_status
  FROM catalog_product_entity_int
  WHERE entity_type_id = (SELECT
    entity_type_id
  FROM eav_entity_type
  WHERE entity_type_code = 'catalog_product')
  AND attribute_id = (SELECT
    attribute_id
  FROM eav_attribute
  WHERE attribute_code = 'status'
  AND entity_type_id = (SELECT
    entity_type_id
  FROM eav_entity_type
  WHERE entity_type_code = 'catalog_product'))) q
    ON cpe.entity_id = q.product_id;</pre><p></p>
<p>Status 1: active<br />
Status 2: not active</p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/680/magento-getting-status-of-every-product-database-using-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calling a stored procedure from Magento</title>
		<link>http://www.the-mage-expert.com/643/calling-stored-procedure-from-magento/</link>
		<comments>http://www.the-mage-expert.com/643/calling-stored-procedure-from-magento/#comments</comments>
		<pubDate>Mon, 16 Jun 2014 14:21:34 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=643</guid>
		<description><![CDATA[Using the code below you can call a stored procedure directly from Magento. [crayon-69f5b379ebd14/]]]></description>
				<content:encoded><![CDATA[<p>Using the code below you can call a stored procedure directly from Magento.</p>
<p></p><pre class="crayon-plain-tag">$resource = Mage::getSingleton('core/resource');
$readConnection = $resource-&gt;getConnection('core_read');
$query = 'CALL stored_procedure()';
$results = $readConnection-&gt;exec($query);</pre><p></p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/643/calling-stored-procedure-from-magento/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting orders with items that have a certain attribute set</title>
		<link>http://www.the-mage-expert.com/608/magento-getting-orders-withitems-with-certain-attribute-set/</link>
		<comments>http://www.the-mage-expert.com/608/magento-getting-orders-withitems-with-certain-attribute-set/#comments</comments>
		<pubDate>Mon, 03 Mar 2014 14:58:38 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[attributeset]]></category>
		<category><![CDATA[order]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=608</guid>
		<description><![CDATA[The following MySQL query returns all Magento orders that have at least one item with attribute set id 9. [crayon-69f5b379ec10a/]]]></description>
				<content:encoded><![CDATA[<p>The following MySQL query returns all Magento orders that have at least one item with attribute set id 9.</p>
<p></p><pre class="crayon-plain-tag">/* 9 = attribute set Id */
select
	increment_id,
	created_at,
	entity_id 
from
	sales_flat_order 
where
	entity_id not in (
		SELECT
			o.entity_id      
		FROM
			sales_flat_order o      
		LEFT JOIN
			sales_flat_order_item i        
				ON o.entity_id = i.order_id      
		LEFT JOIN
			catalog_product_entity p        
				ON i.product_id = p.entity_id      
		WHERE
			p.attribute_set_id = 9
	)</pre><p></p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/608/magento-getting-orders-withitems-with-certain-attribute-set/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting all items from the compare list in the database</title>
		<link>http://www.the-mage-expert.com/604/magento-deleting-all-compare-list-items-in-database-mysql/</link>
		<comments>http://www.the-mage-expert.com/604/magento-deleting-all-compare-list-items-in-database-mysql/#comments</comments>
		<pubDate>Wed, 26 Feb 2014 12:41:28 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[compare list]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=604</guid>
		<description><![CDATA[The following MySQL query deletes all rows from the Magento compare list table. [crayon-69f5b379ec5e3/]]]></description>
				<content:encoded><![CDATA[<p>The following MySQL query deletes all rows from the Magento compare list table.</p>
<p></p><pre class="crayon-plain-tag">delete from catalog_compare_item;</pre><p></p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/604/magento-deleting-all-compare-list-items-in-database-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting the SQL of a collection</title>
		<link>http://www.the-mage-expert.com/358/magento-getting-sql-of-collection/</link>
		<comments>http://www.the-mage-expert.com/358/magento-getting-sql-of-collection/#comments</comments>
		<pubDate>Thu, 16 May 2013 10:12:56 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[collection]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=358</guid>
		<description><![CDATA[Use the following code to get the underlying SQL of a Magento collection: [crayon-69f5b379eca49/]]]></description>
				<content:encoded><![CDATA[<p>Use the following code to get the underlying SQL of a Magento collection:</p>
<p></p><pre class="crayon-plain-tag">$sql = (string)$collection-&gt;getSelect();</pre><p></p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/358/magento-getting-sql-of-collection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting upsell products directly in the database</title>
		<link>http://www.the-mage-expert.com/316/magento-deleting-upsell-products-in-database/</link>
		<comments>http://www.the-mage-expert.com/316/magento-deleting-upsell-products-in-database/#comments</comments>
		<pubDate>Thu, 11 Apr 2013 11:21:34 +0000</pubDate>
		<dc:creator><![CDATA[Mex]]></dc:creator>
				<category><![CDATA[Magento Solutions]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[upsell]]></category>

		<guid isPermaLink="false">http://www.the-mage-expert.com/?p=316</guid>
		<description><![CDATA[Once saved, upsell products can not be removed again easily. Using the following MySQL script, you can delete Magento upsell products from the database. [crayon-69f5b379ecec3/]]]></description>
				<content:encoded><![CDATA[<p>Once saved, upsell products can not be removed again easily. Using the following MySQL script, you can delete Magento upsell products from the database.</p>
<p></p><pre class="crayon-plain-tag">DELETE link.* FROM catalog_product_link AS link
LEFT JOIN catalog_product_link_type AS linktype ON (linktype.link_type_id = link.link_type_id)
WHERE linktype.code = &quot;up_sell&quot; and product_id = 123;</pre><p></p>]]></content:encoded>
			<wfw:commentRss>http://www.the-mage-expert.com/316/magento-deleting-upsell-products-in-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
