Questions tagged [sql]

Questions about using raw SQL queries. For questions about the database in general, use the database tag instead, for questions about the Magento database access layer use the appropriate tag, like: eav, model, resource-model, collections, install-script

This tag is for questions about raw SQL queries.

For questions about the MySQL database in general, use .

For questions about infrastructure regarding the database, use

For questions about using the database access layer in Magento code, see:

664 questions
8
votes
2 answers

display a sql query being generated

Im trying to learn how to join two tables using this tutorial but I'm returning a sql error. In order to work what ive done wrong I would like to see the query being generated, how do I display it? I've tried Zend_Debug::dump($collection); that…
tony09uk
  • 1,707
  • 11
  • 41
  • 56
4
votes
2 answers

What's the reason for sql-updates being triggered multiple times?

When an existing extension is updated either manually or using Magento-Connect, in some occasions the sql-updates are triggered multiple times right away or again after a short while, although the version is correctly saved in the table…
matthias
  • 51
  • 4
2
votes
2 answers

Copy Reviews from website_id 1 to website_id 2

This is more of an SQL question. I have very little knowledge in MySQL In the review_store table, there are two columns: review_id and store_id If I had to replace 1 with 2 I would do this: UPDATE review_store SET store_id = '2' WHERE store_id =…
Hiboomedia
  • 214
  • 1
  • 8
2
votes
2 answers

Subquery Using Magento's DB Functions

I am trying to do a query of the form: SELECT TableA.id, TableB.id FROM TableA INNER JOIN TableB ON TableB.a_id = TableA.id WHERE TableB.field1 = ( SELECT TableB.field1 FROM TableB WHERE TableB.a_id=TableA.id ORDER BY TableB.created_at DESC…
user2045
  • 831
  • 3
  • 16
  • 29
1
vote
1 answer

Magento EE SQL to get customers who purchased and newsletter subscribed

I have a Magento EE 1.14.0.1 and I have access to mysql. What I am trying to do is write a query in SQL that will give me a listing of all customers first name, last name, email address AND the website ID that they created an account on (this…
Jayreis
  • 705
  • 2
  • 27
  • 73
1
vote
1 answer

Update weight through sql query

I have created tons of products without setting the weight. Now I would like to add the weight, same weight to all products. Can a sql query help me? Is there some other solution.
Robert Ramsey
  • 11
  • 1
  • 2
1
vote
2 answers

Sql Query Not Working in DB

When i try to run sql query, its not working. i get error like, My Query is below SELECT cpev.value as Name,cpe.sku,gp.value category_url, ea.value image_path FROM catalog_product_entity cpe inner join (SELECT entity_id,value FROM…
Gem
  • 699
  • 16
  • 50
1
vote
1 answer

Move SKU numbers to custom attribute and clear SKU afterwards for all products (SQL)

He Guys, I'm hoping you can help me out. I'm a complete novice when it comes to SQL. I'd like to move all the SKU values of every product to a new custom attribute (with attribute code: locaitenr) after this is done I'd like to clear (reset) all the…
0
votes
2 answers

Bulk disable products without a category in SQL

Can anyone provide me with a good SQL query I can run to disable products that have no category? I have been trying to use extensions to do this and have yet to get a reliable program.
Eric Conklin
  • 103
  • 2
0
votes
2 answers

Product Edit SQL Error

It's been a few days that this error show up when editors editing a product: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right…
Shahroq
  • 136
  • 3