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

Filter by
Sorted by
Tagged with
0 votes
2 answers
32 views

Magento 2 - Customer Type Table SQL

I need to create a query that will list me as in the admin panel all registred customers, of course, I can do it through the tables customer_entity. However, it does not contain the customer type ...
user avatar
  • 1
0 votes
1 answer
21 views

Will the same php and mySQL versions work for both Magento 2.4.2-p1 and Magento 2.4.4?

I have a Cloud VPS account which currently runs Magento 2.4.2-p1. I would like to install Magento 2.4.4 in a separate account in that Cloud VPS but I'm told we will have to upgrade php and mySQL for ...
user avatar
  • 306
0 votes
1 answer
7 views

JSON functions in MBI SQL builder

According to the docs, all functions that are not mutations should be included in the SQL syntax. I have a MySQL integration in MBI, but when I try to test some basic SQL functions such as ...
user avatar
0 votes
0 answers
10 views

How to get 4th image of a Product so that I can assign it a particular Attribute (hovering)?

I have a requirement to assign the 4th image of a product a custom attribute 'hover_image', which will be shown when a user hovers over the product on PLP. I have done this using position value stored ...
user avatar
0 votes
0 answers
34 views

How to update table with model collection

I am trying to update the customer_entity table. But I am doing a left join with customer_address_entity. I want to update the group_id only when store_id matches my customer variable. Is this ...
user avatar
  • 45
1 vote
1 answer
101 views

Magento 2 - How to find all products with Salable qty as 0 via SQL query?

Is there a simple SQL query I can run to find any ENABLED product in Magento that has a salable quantity which is 0? We have thousands of products and in the back end product grid we can sort and ...
user avatar
  • 23
0 votes
0 answers
16 views

How do I write an SQL query for Orders by SKU with Shipiping to California between X and Y dates

I can't find a way to generate a table or report that will get me Orders by SKU with Shipping to California between X and Y dates. Anyone ever tackle this without an extension. Thanks so much :-)
user avatar
0 votes
1 answer
28 views

Database loading Product Collection slow (Minutes)

I've got some third party code here that loads a larger product collection. It takes around 9 minutes to load on decent hardware. We have some 150000 SKU in the database. Collection: SQL is: SELECT ...
user avatar
1 vote
2 answers
502 views

Magento 2: SQL Query to get product SKU's based on the Category Id

I need a sql query to get the all sku based on the category id Following are the tables which stores category and product data: catalog_product_entity catalog_category_product Thanks
user avatar
  • 1,582
0 votes
2 answers
31 views

Magento 1.9: Sql setup Stripe module not execute

I'm installing throught composer the Stripe module, the problem is that when I installed the site, where the module work, crash because can't find the table in Database. I don't know why the setup sql ...
user avatar
  • 1
0 votes
1 answer
79 views

Is there any way to get enabled and disabled simple product of configurable product in Magenoto 2?

Is there any way to get enabled and disabled simple product of configurable product in Magento 2. I need to get all id of enable and disabled product by using SQL query or object manager approach. Can ...
user avatar
  • 526
0 votes
0 answers
21 views

Getting access of records in db, SQL file size is 18+GB while export

I have exported my database in SQL file using the MySQLDump command from the SSH terminal. My store contains the data as below: No. of products below 40,000. No. of customer below 3000. No. of ...
user avatar
0 votes
0 answers
80 views

Magento 2: How do I get the tables that contains data of Categories, Products, Customers, Orders, Product Reviews Product Attributes and its values?

I want to export the tables that contain the data of Categories, Products, Customers, Orders, Product Attributes and its values (along with the custom attributes) Product Reviews from my Magento 2 ...
user avatar
0 votes
0 answers
29 views

SQL error on Database Import, while setting up staging site

I have been trying to import a database to clone a production site that is working and I am receiving this error when trying to import the database. Error Static analysis: 2 errors were found during ...
user avatar
0 votes
0 answers
14 views

magento brand showing error

i am getting error this error Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S22]: Column not found: 1054 Unknown column 'e.manufacturer' in 'where clause', query was: SELECT FLOOR((ROUND((e....
user avatar
  • 3
0 votes
2 answers
31 views

Magento: Reduce product weight by 1000x for all products

We migrated from Magento 1 to Magento 2. All weight values were added in grams in Magento 1. In Magento 2 the weight setting is in KG. So all product weights are 1000x too much. What SQL query can I ...
user avatar
  • 1
0 votes
0 answers
72 views

Magento 2 How to set url key for default store view

Magento 2.3.5 version How to set URL key for default store view? Example - All store view URL-key - xyz-test which is correct Default Store View URL-key - abc-test it is not correct I want to set the ...
user avatar
  • 1,143
0 votes
0 answers
23 views

Set country of origin

there is a task to create an attribute country of origin and fill it in in accordance with the attribute country of manufacture, for example (Germany -> DE), and the question arose where to get the ...
user avatar
  • 1
1 vote
1 answer
40 views

Assign orders to customers where the emails are matching with a SQL query

I want to reassign existing orders to customers after deleting all customers and importing them into Magento 2 from a csv. The sales_order.customer_id values are not matching with the correct customer ...
user avatar
0 votes
0 answers
20 views

Magento 2 getting products use sql

I'm trying to get all products using Magento SQL. I just need to do some tweaks. If the product has a thumbnail, it should show its value and if it is null, it should show my custom text. My code ...
user avatar
  • 828
2 votes
0 answers
139 views

Magento 2 : Get product name using mysql query

I am using Magento ver. 2.4.2 Is their any way we can get product attributes by id using mysql query ? I also need some custom attributes for product in same query THE BELOW SQL QUERY WORKS BUT GET ...
user avatar
  • 367
0 votes
0 answers
108 views

Magento 2: Get used and unused attributes

I want to get list of attributes (not only products or categories) that are used and that are not use. I try this Delete unused attribute values one but it's only for product attribute, this is for ...
user avatar
0 votes
1 answer
33 views

SQL Syntax error when getting collection on listing

I've created my own module for managing leaflets in home page and i wanted to have a listing with existing leaflets. I've created UI_Component for listing (by Magicento) but when I go to listing page ...
user avatar
  • 27
1 vote
1 answer
84 views

Why does it matter in which order I add attributes to a filter?

Compare this code $productIdQuery = $this->productCollectionFactory->create() ->addAttributeToSelect('customer_group') ->addAttributeToFilter([ ['attribute' ...
user avatar
  • 14.7k
0 votes
1 answer
917 views

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: After Updating a Module

On My site i am running old version of Advanced Product Options Suite Extension for Magento 2 by mageworx. I just updated the Advanced Product Options Suite Extension into latest version. I tired ...
user avatar
0 votes
1 answer
48 views

How to import 3 tables dump into database using script?

I want to include 3 tables SQL dump into that database, how to add it by using a custom module or script or any best practice.
user avatar
  • 95
1 vote
2 answers
1k views

How to get all products info from database by SQL Query in Magento 2.3?

I want to get the below data of all products by SQL Query. SKU Product name Website Attribute set Quantity per source Sellable quantity visibility Price Status I have used this extension: https://...
user avatar
0 votes
1 answer
86 views

SQL is_in_stock field not updating to Website

I am updating is_in_stock field in cataloginventory_stock_item as follows: UPDATE cataloginventory_stock_item ci SET ci.is_in_stock = CASE WHEN ci.qty = 0 THEN 0 WHEN ci.qty > 0 THEN 1 END WHERE ...
user avatar
  • 11
0 votes
1 answer
37 views

Re-indexed procedure in Magento 2

If i update 10K products and re-indexed it first time it will re-indexed all. But if i update 10 more product so it will require re-index so my question is is it re-index all the products from ...
user avatar
  • 526
0 votes
1 answer
49 views

How to Make Indexing process Async. in Magento 2

I am using Indexing process in Magento 2. I have 60 Million products and when i run indexer it just struck in processing from past 4 days. When i check indexer status on sow processlist it will run ...
user avatar
  • 526
1 vote
4 answers
822 views

Where is URL Key information stored in database?

I'm using a mass import extension to import product URL Keys for a Magento 2.3.0 site which recently went live. The URL key information in the backend product detail is correctly updated but Magento ...
user avatar
  • 101
0 votes
3 answers
100 views

I want to fetch Product Names on behalf of comma separated SKU's

I want to fetch Product Names on behalf of comma separated SKU's i.e. sku1,sku2,sku3 and the expected result is Name1,Name2,Name3
user avatar
0 votes
1 answer
127 views

How to export products with tier prices directly via database using SQL?

I want to export these data from my Magento 2.4: Status Product Name SKU Price Advanced Pricing Quantity How could I do it via SQL?
user avatar
1 vote
1 answer
205 views

Magento 2 - How to get data from table customer_log?

I need to get the value for last_login_at for the current customer, but this seems to be impossible without the use of SQL. Current Solution (SQL): /** * @var \Magento\Framework\App\...
user avatar
  • 2,441
0 votes
4 answers
208 views

how to use date() in magento query?

I want to filter some orders based on the date range so in SQL i use this query SELECT * FROM `sales_order` WHERE date(created_at) >= '2020-12-02' AND (date( created_at) <= '2020-12-...
user avatar
0 votes
1 answer
52 views

How do I change not using ObjectManager directly? and use Dependency injection?

How do I change not using ObjectManager directly? and use Dependency injection? what about my SQL query? My code is work, but seems not in good Magento style, anyone can help to correct me? I am ...
user avatar
  • 518
0 votes
1 answer
348 views

SQL query to get products enabled, in stock without images?

I'm running a Magento 2.3 and I would like to run a query in my database to export some products data that I don't have natively via the admin panel, the attributes are: Status Stock Images How ...
user avatar
0 votes
1 answer
31 views

Create a custom magento cron job

Is it possible to create a custom magento cron job. The task I want it can be done by run sql query using php to process some logic of the sql result send out email to customer service. cron job ...
user avatar
  • 518
0 votes
1 answer
393 views

How to change product status from sql using SKU

I need to disable and enable a huge quantity of products filtering by sku and the easiest solution seem to be through Sql query but i have some issues to find the right code For example i need to ...
user avatar
0 votes
1 answer
29 views

Can not display all column from a table

I have a table name my_cars. There are 4 column in my table. I create collection, model, recourse model,controller and block. And i can display data from my table. But all column of data not ...
user avatar
0 votes
1 answer
107 views

Invalid security or form key. Please refresh the page. UI Form magento 2

I`m using this plugin , but i have another table structure. I can add new item to database bur if i edit item i get err Invalid security or form key. Please refresh the page. My table structure id, ...
user avatar
0 votes
1 answer
377 views

How to filter customer by custom attribute using SQL query?

The zd_user_id is our customer custom attribute. $customerCollection = $this->customerFactory->create(); $customers = $customerCollection->addAttributeToFilter( [ ['attribute' =&...
user avatar
0 votes
1 answer
243 views

Notice: Array to string conversion in shipping delivery on magento 2

I upgraded from magento 2.2.2 to 2.2.11 since I have an error when selecting a shipping address. I get the error: "Notice: Array to string conversion in mywebsite/vendor/magento/framework/DB/...
user avatar
0 votes
1 answer
1k views

How to get custom attribute value with product id of enable product with SQL query in Magento 2?

How to get custom attribute value with product id of enabled product with SQL query in Magento 2? I am using SELECT entity_id,value FROM catalog_product_entity_varchar WHERE attribute_id = 150 But it ...
user avatar
  • 526
0 votes
1 answer
151 views

Magento 2 delete Meta Name Meta Title Meta Description ALL products

Magento 2 delete Meta Name Meta Title Meta Description ALL products Please can someone let me know if its possible to delete the Meta Values for all products in my store These were added during import ...
user avatar
  • 125
0 votes
1 answer
253 views

How to get SQL query for product insert in Magento 2?

How to get SQL query for product insert in Magento 2 ? I have multiple products around 10 Lakhs so i want to insert it using SQL query. But how will i get the insert query of the product ? Any Help is ...
user avatar
  • 526
0 votes
1 answer
80 views

Move house number from street 1 into street 0 for existing address in db - Magento 2.3.5

At the moment we use the street 1 field for the house number in our Magento 2.3.5 store. But we want to revert this and only use 1 street field for both the street and house number. So we need to move ...
user avatar
  • 1,474
0 votes
1 answer
345 views

How to get customer and company data in a CSV file from MySQL?

I'm running a Magento Commerce Cloud B2B, and I need to get a list of these data below. Customer ID Customer Name Company Name Company User Agreement As I can't export a file with these pieces of ...
user avatar
0 votes
1 answer
650 views

Magento2 - php bin/magento setup:upgrade - Access denied for user 'user'@'localhost' (using password: NO)

Fairly new to Magento, I am trying to develop a custom module and have run the CLI command php bin/magento setup:upgrade. However I am getting the following error; SQLSTATE[HY000] [1045] Access denied ...
user avatar
0 votes
2 answers
808 views

Column not found: 1054 Unknown column 'cat_index_position' in 'order clause'

I am getting a SQL error on a few category pages after I upgraded to Magento 2.4.0. I do not have any errors during re-indexing. Flat tables are also disabled. Also, there is no custom code for the ...
user avatar

1
2 3 4 5
13