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
1
vote
3answers
30 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
0
votes
0answers
9 views

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

I want to export these data from my Magento 2.3: Status Product Name SKU Price Advanced Pricing Quantity How could I do it via SQL?
1
vote
1answer
24 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\...
0
votes
4answers
42 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-...
0
votes
1answer
31 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 ...
0
votes
1answer
17 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 ...
0
votes
0answers
4 views

Magento 2.3.6 - How to Bulk change existing & new Product image file name for SEO

How can I change the filename of existing & new product images as per SEO instead of just sku type names. I noticed some similar threads here, but those are for Magento 1. Can anyone pl help me ...
0
votes
1answer
22 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 ...
0
votes
1answer
41 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 ...
0
votes
1answer
18 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 ...
0
votes
1answer
35 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, ...
0
votes
1answer
24 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' =&...
0
votes
1answer
36 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/...
0
votes
1answer
195 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 ...
0
votes
0answers
9 views

Magento v1.9 cmd line sql query to find certain scenarios backorder out of stock

I have a real odd issue Magento v1.9.4.5 I have a ton like thousands of products that are set to back order allowed However they also say out of stock I need help I not sql expert I need a sql query ...
0
votes
1answer
37 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 ...
0
votes
1answer
55 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 ...
0
votes
0answers
21 views

Error Code appears when editing product and category links no longer work on website

my website went down a few days ago, I use fast hosts, they reconnected my VPS but since then my category pages no longer work, products do not show on home page and whenever I save a product I get ...
0
votes
1answer
27 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 ...
0
votes
1answer
38 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 ...
0
votes
1answer
105 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 ...
0
votes
0answers
7 views

Magento 2 insert in concurrent series

I have a multiseller store. I'm creating a seperate seller invoice within series. My table data is like below id seller_id invoice_id invoice_series order_id For example if a seller name is John, I ...
0
votes
1answer
107 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 ...
0
votes
2answers
37 views

Magento 2 - Delete all products with ID 140.000 and higher

We have a lot of duplicate products in our Magento 2 store, that we need to remove. Now I am looking for a way or a sql query to remove all products from id 140.000 or higher. So all products from 1 ...
0
votes
1answer
297 views

Magento 2.3 - How to bulk import attributes values?

What is the best practice to bulk import attributes values. How to do it by hit tables?
1
vote
1answer
24 views

I need to set the 'OR' condtion for last where clause but it is setting as AND how can change in magento 2.3

SQL need to change AND condtion to OR in below code public function getOrders() { $po_number = "%"."A"."%"; if (!($customerId = $this->...
0
votes
3answers
26 views

Script to round all product prices in database to 2 decimal places

What is the best approach to go through all products PRICES (price, final price, promo price, group price ...) and round them to 2 decimal places. for example: 28,1200 -> 28,1200 28,1255 -> 28,...
1
vote
0answers
13 views

Magento 2.3 - Changed attribute media_gallery to scope “Store View”, but want to revert it to “Global” error

We changed the scope of the attribute media_gallery to scope "Store View", but we want to revert it back to "Global", like the default setting. But when we revert it, we get the ...
2
votes
1answer
110 views

How to print raw sql query by applying filter on searchCriteriaBuilder in Magento 2

How to print raw SQL query by applying filters on searchCriteriaBuilder ? I am using the following method, but it's giving error: "Uncaught Error: Call to undefined method Magento\Framework\Api\...
0
votes
0answers
35 views

How to customize SQL query

I have 1 module with model, resource model and collection. Now I can get data with SQL query: SELECT main_table.* FROM table_abc AS main_table; I want to customize this query by adding WHERE clause (...
0
votes
1answer
18 views

How to remove all special prices for a specific customer group

I accidentally uploaded special prices for an erroneous group of customers. How to remove all special prices for a group of customers, not login (customer_group_id = 0) for all products and items from ...
0
votes
1answer
23 views

convert sql query to magento addFieldToFilter combine OR and AND

You can convert me this sql I did not arrive at combined OR and AND at the same time SELECT * FROM sales_order AS main_table, sales_order_payment AS sop WHERE ((status = 'processing') Or ((status = '...
0
votes
1answer
72 views

Error while retrieving wishlist data

i am trying to retrieving wishlist data and this error appears [2020-06-22 08:41:10] report.CRITICAL: Report ID: webapi-5ef06ea694149; Message: SQLSTATE[23000]: Integrity constraint violation: 1452 ...
0
votes
0answers
34 views

SQL Error SQLSTATE[42000]: Syntax error or access violation: 1064

This started happening recently, I don't know when since I have multiple users: I save a new product simple, configurable or bundle and I get the following error listed below. The product gets saved ...
0
votes
2answers
16 views

Magento2 addFieldToFilter, Need 'and' and 'Or' in sql

I need magento sql collection. Query need like that. select * from custom_table where customer_id=xx or (customer_group=1 and custom_field=1) I can add or operator like below select * from ...
0
votes
0answers
94 views

Magento 2 - How to use mysql find_in_set?

In Magento 2, I try to use find_in_set mysql function but without success. I try this : $result->getSelect()->order("find_in_set(e.entity_id,'".implode(',',$sort_order)."')"); But it give me ...
1
vote
1answer
81 views

Magento 2 trying to add column in installschema.php magento 2.3.5 p1

I am trying to make the length higher than 255 <?php namespace []\[]\Setup; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Setup\InstallSchemaInterface; use Magento\Framework\Setup\...
-1
votes
1answer
48 views

How to query products without weight in magento 2?

I have been able to SQL query my products that have weight in Magento 2 select * from catalog_product_entity_decimal where attribute_id=80 and value is not null However, when I try to look up ...
0
votes
1answer
48 views

How to solve slow performance, slow and long running CRONs in Magento Cloud?

I'm having these two main issues below in my Magento 2.3.2 Enterprise Cloud. Heavy SQL load and site performance issues. Long-running and stuck CRON. How could I solve it?
3
votes
1answer
45 views

Query to change the status of bulk magento orders

I have a lot of Magento Orders with the wrong status Is there a way to change that bulk using a sql query? Thanks in advanced
0
votes
0answers
12 views

Convert SQL Select to Magento getCollection statement; Dates and multiple joins

I am not familiar with Magento and need to translate a sql select query into a Magento's equivalent getCollection statement. Thanks for assistance SELECT ordertot.entity_id as order_id, `...
0
votes
0answers
6 views

Get shipping from order

I'm doing a cronjob and I need to get the shipping value, this one SELECT "shipment_label_id" FROM "shipment_label" WHERE "order_id" = 66591 The shipping is saved like that in just that table atm ...
0
votes
0answers
58 views

Magento 2 In Stock Out of Stock not changing CSV

I am really stuck on this issue - I have a Magento 2.2.2 store and trying to use default import/export and also other extensions for importing and updating stock and qty. However I have found that ...
1
vote
1answer
45 views

Can't reset the AUTO_INCREMENT value of the custom table [closed]

I can't set the value of the auto-increment to '1' (table is already truncated) the query is: ALTER TABLE 'mam_color_codes' AUTO_INCREMENT=1; and if I check the table status: SHOW TABLE STATUS FROM '...
0
votes
1answer
29 views

Magento SQL unknown query

we are seeing this SQL query in our DB and are unsure what is generating this, we have flat catalog index enabled so it should not be asking for this sql query select `e`.*, if(at_visibility.value_id &...
1
vote
0answers
101 views

Add all products to websites/storeview by sql

I have more then 10k products in base store and want now assign all to new website as multistore in system with/by sql how i assign all products to the new websites/storeviews using sql? use Magento ...
0
votes
1answer
39 views

Possible raw SQL statement detected. delete from $tableName WHERE sku = $productSku

the code is working well and doing it's job but pipeline on bitbuckets drops an error Possible raw SQL statement "delete from $tableName WHERE sku = $productSku " detected. my function where this ...
0
votes
0answers
48 views

How to use a SQL query to export all the products?

I'm having issues when exporting all my products via the admin panel, how could I get all the products data via a SQL query using Magento 2.3?
0
votes
1answer
28 views

how to enable font-family tool in WYSIWYG editor in magento 2

i want display fontfamily in the wysiwyg editor in magento2
0
votes
0answers
33 views

When i run Setup upgrade CLI i got SQLSTATE[42S02]: Base table or view not found

Please give me the solution for this problem, I didn't change any modules i can't catch this error how it occured > SQLSTATE[42S02]: Base table or view not found: 1146 Table > 'amtdb....

1
2 3 4 5
13