Questions tagged [query]

Denotes the question related to database SQL query( in context of magento ).

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

How to find admin custom url in database core_config_data table using sql query in magento2

Run this command on SQLyog or other tools. Your Custom Url: http://localhost/magento2ProjectName/stage3fedex7id4w/ SELECT * FROM core_config_data WHERE PATH LIKE "%admin/url/%"; =============...
user avatar
0 votes
0 answers
19 views

How to change filter "and" to "or"?

version : Magento 2.4 safira I want my website show every products related to filters I choose. If I choose multi filters, I only got products fulfilled all conditions. Is there any way I can edit ...
user avatar
0 votes
1 answer
16 views

how do I write a paremeterized delete query using json_extract?

I would like to write a query like delete from inventory_reservation where JSON_EXTRACT(metadata, '$.object_increment_id') = '<increment_id>' So I created my expression in my code like $...
user avatar
  • 521
0 votes
0 answers
11 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
23 views

How to log query for cart event?

I want to see the mysql query when adding a product to the cart. I have referred this link, How to log all Magento 2 SQL queries? but I need query only for cart. How to get the query for cart events? ...
user avatar
  • 470
0 votes
1 answer
152 views

MySQL query for list all the categories and its description from Magento 2 database?

How to get all the categories and its description from Magento 2 Database using MySQL Query ?
user avatar
  • 1,357
0 votes
1 answer
369 views

Magento 2 How to add custom product attribute into existing product graphql query

How to add custom product attribute into existing product graphql query in the custom module in Magento 2. THANKS.
user avatar
  • 3,157
1 vote
2 answers
469 views

Magento 2 How to create graphql query

How to create custom graphql query in custom module in magento 2. THANKS.
user avatar
  • 3,157
0 votes
3 answers
339 views

How to Print Raw SQL query of Magento 2 format?

I am trying to print the raw SQL query of the below statement in Magento2 but am not able to do it. please find the statement $connection = $this->getConnection(); // I am getting the connection $...
user avatar
  • 1,357
0 votes
1 answer
23 views

Does Magento execute a query to get the review count of each single product on the category listing page?

Let's say that your category page shows 36 products at a time and shows the rating/review count underneath each product title. Does Magento perform 36 queries to get each of the product's review ...
user avatar
1 vote
0 answers
20 views

Executing direct query in Magento 2 issue

this is my code: $connection = $this->resourceConnection->getConnection(); $connection->query("SET @@group_concat_max_len = 1000000"); I have a query using a group concat. The ...
user avatar
  • 3,535
0 votes
2 answers
29 views

Strange search terms automatically added to Search Query table

Strange search terms appear in Last Search Terms and Top Search Terms which are from Search Query table. What can be the reason?
user avatar
0 votes
0 answers
19 views

How can I stop the backend Admin Sales Orders page from auto-querying on page opening/refresh?

I'm very new to Magento (2.3.5), so don't know what's possible to change (or not)? I want to have the Admin Sales Orders page "NOT" auto-query the Orders and present the first 20 Orders (...
user avatar
0 votes
1 answer
36 views

Get Latest Entry For Duplicate Rows In Collection

I currently have a logs table which has the following rows which use the same order_id: log_id order_id user action 2410 1001318004 test1 Declined 2409 1001318004 test1 Declined Inside my app/code/...
user avatar
  • 99
0 votes
2 answers
30 views

How to remove pending reviews directly in database

How can I remove all pending reviews in certain store view directly from database? What should I use as SQL query?
user avatar
  • 1,461
0 votes
0 answers
23 views

Optimizing database queries on Magento 1.9

I'm currently working on optimizing my shop running Magento 1.9.3.7 and my Slow Query Log shows only one query as below: SELECT `main_table`.`entity_id`, main_table.`name`, main_table.`path`, `...
user avatar
0 votes
1 answer
330 views

Magento 2 : row id and entity id not same in catalog_product_entity table

Executed query - SELECT GROUP_CONCAT(parent_id SEPARATOR ',') AS parent_id FROM catalog_product_super_link AS super_link WHERE super_link.product_id = 914066 The issue is there are records where &...
user avatar
  • 367
0 votes
1 answer
18 views

MySQL Query of catalog_product_super_link filtered by attribute_set_id

I want to export all fields from the catalog_product_super_link table, but filtered to exclude any products that have have a certain attribute_set (31 in this case). This post (MySQL Query filtered by ...
user avatar
  • 1
0 votes
1 answer
32 views

How to set the conditions for displaying of the related-products

Overriding related-product collection. My aim is to set limit for related product display. Related-products are not displayed if there are less than 10 products, the maximum number of products that ...
user avatar
  • 21
0 votes
1 answer
126 views

Cron job to delete catalog_product_entity_datetime table data, am I using the correct interface?

I have a query to select data from catalog_product_entity_datetime table. can I use below interface to grab the data from above table? If can't what should I do to grab data from this table? I don't ...
user avatar
  • 508
0 votes
2 answers
173 views

how to optimize queries in magento 1.9 with lots of attributes (over 500)

I have a website running Magento 1.9 which is flooding mysql with slow queries like this SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS `e` INNER JOIN `...
user avatar
  • 521
1 vote
1 answer
44 views

Magento2 - How do I write below query function into non-deprecated? without using getCollection()

How do I write below function into non-deprecated? In Magento2. without using getCollection() public function getNewCustomer() { $customerData = $this->customerFactory->create()->...
user avatar
  • 508
0 votes
1 answer
149 views

How do I change this sql query to Magento2 filter collection method?

I have below query SELECT * FROM newsletter_subscriber WHERE change_status_at >= (NOW() - INTERVAL 10 DAY); How do I make it works with below? public function getSubscriberStatus() { ...
user avatar
  • 508
0 votes
1 answer
47 views

I have no idea why my Subscriber Collection Factory is not working

I have no idea why my Subscriber Collection Factory is not working. Below is my code. Wish someone can help me to fix my problem. I believe something wrong with my setup of CollectionFactory use ...
user avatar
  • 508
0 votes
3 answers
60 views

I have below sql query, how do I turn this to Magento get data method to retrieve data?

I have below sql query, how do I turn this to Magento get data method (collection?) to retrieve data (not using ObjectManager)? Please help. public function getNewCustomer() { $objectManager = \...
user avatar
  • 508
0 votes
4 answers
185 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
63 views

How to add media query for div alignment [closed]

My design, I need mobile view like, first block second block third block fourth block How to include media query? Script : <div class="container"> <div class="...
user avatar
  • 103
1 vote
2 answers
563 views

Retrieve product url with category in the graphQL

I've enabled at backoffice the usage of the category inside the product url by setting this option: When I access the magento frontend, I can now access the product with the url <category>/<...
user avatar
  • 218
0 votes
1 answer
29 views

Change stock availability of products based on qty

I'm looking for a query to get all my products that have "qty > 2 and 'stock availability = 0'" and change the stock availability to 1. A crash on my inventory update routine did a mess ...
user avatar
  • 47
0 votes
2 answers
54 views

how do I change this sql query to magento get data method?

I have below sql query, how do I turn this to Magento get data method to retrieve data? Please help SELECT sales_order.increment_id, sales_order_payment.additional_information FROM sales_order LEFT ...
user avatar
  • 508
0 votes
1 answer
329 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
1k views

Using GraphQL query and filtering products by category_id, I get empty items array

I try to make a simple request using graphql and to get a response from my magento. I have a parent category named Products(id:"3"). In this one, there are 3 subcategories A(id:"5")...
user avatar
0 votes
1 answer
245 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
0 answers
404 views

magento 2 change store id

I have a multi store Magento 2 site and I need to change the ID of one of the stores. Is there any easy way to do this? I tried to run an update query on the store table but I get and error because ...
user avatar
2 votes
1 answer
436 views

Base images as first image, change positions in bulk - Magento 2.3.5

We have a large catalog (125K products), with a lot of products where the base image is positioned somewhere in the middle of the gallery. The selection of base image itself is fine, this should be ...
user avatar
  • 1,474
0 votes
0 answers
34 views

Make last image in galary Base, Small and Thumbnail query - Magento 2.3.5

The following sql query changes the Base, Small and Thumbnail to the first image. We want to use something like this query, but then select the last image in position and make that Base, Small and ...
user avatar
  • 1,474
1 vote
1 answer
21 views

How to Wirte OR/and Query in magento2.?

SELECT main_table.sku, main_table.order_id, main_table.parent_item_id, main_table.name, main_table.product_id FROM sales_order_item AS main_table WHERE (order_id = '3') AND (parent_item_id IS NULL) ...
user avatar
0 votes
1 answer
791 views

Magento 2 : get Mysql Query of products

I wanna show in my mysql query of all attributes name,product name, product status is 1 and sku but in my query its not showing product name and status so could you help me in my this query ? SELECT ...
user avatar
2 votes
1 answer
1k views

Magento 2 GrahQL Product Sorting does not work for the product query with category Filter

I have this graphQL query { products(filter: {category_id:{eq: "5"}, price: {from: "0", to: "999999"}}, pageSize: 10, currentPage: 1 sort: {position: DESC}) { ...
user avatar
  • 1,946
0 votes
2 answers
26 views

What is the query readers here i can't understand magento 2.3

I can't find the what query rendes here and i can't it is not readable so any can to find what query renders hear please tell what are the table involved here public function getCount(\Magento\...
user avatar
  • 300
1 vote
0 answers
104 views

SearchCriteria vs Collection - Query Performance Difference

I am trying to refactor get category data method. Initially, it was written with Collection filter. Later I refactored with the search builder interface. When I tried to compare the querying time, I ...
user avatar
  • 1,935
0 votes
0 answers
342 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 ...
user avatar
  • 95
0 votes
0 answers
37 views

Magento2 store table the store_id needs changed from 2 to 0 to be reset

Not sure how it has occurred, but in our store table, the store_id has changed to 2, but should be 0 I believe for admin. What is the query to run to reset it? We have backups with the correct values,...
user avatar
  • 1,013
0 votes
2 answers
461 views

Create an SQL script to find a simple product name with its configurable product SKU In Magento 2 [Magento 2]

Create an SQL script to find a simple product name with its configurable product SKU In Magento 2 [Magento 2] Anyone with a better solution than my one are appreciated. Please share your answer.
user avatar
2 votes
2 answers
669 views

Magento 2 Long Running Queries Stuck in 'Sending Data'

We are running Magento 2.3.1 which has been running properly for a while. Recently the site began to experience extremely long wait times whenever hitting pages not cached by Varnish such as ...
user avatar
1 vote
1 answer
268 views

Use of sub query within collection in Magento

I am using a subquery in Magento collection, Here is my code. $websiteId = $this->storeManager->getStore()->getWebsiteId(); $collection = $this->_productCollectionFactory->create(); $...
user avatar
  • 1,719
0 votes
0 answers
104 views

insert custom option from sql query

I want to insert custom options for a product via sql query. I tried with these queries: INSERT INTO catalog_product_option ( sku, product_id, image_size_x, file_extension, option_id, image_size_y, ...
user avatar
  • 455
1 vote
1 answer
815 views

Magento 2 addFieldToFilter check for NULL not working

What i am doing ->addFieldToFilter('value', array(['eq' => '', array('isnull' => true)])) What i want in the query - '((value = '' )is NULL)` Can anyone help me on this Thanks.
user avatar
0 votes
1 answer
126 views

How to compare value inside array in magento 2 join query?

$this->getSelect()->join( ["address" => "sales_order_address"], 'main_table.entity_id = address.parent_id AND address.address_type = "shipping"', array('region') )->joinLeft( ["so" => "...
user avatar
  • 309
1 vote
0 answers
365 views

Most bough items block porto theme: addition of a stock check

A client is using Magento 2.1.3 with the Porto theme. The homepage of that site has a div which has tabs of different categories with the most bought items. Per category it loads a block in the ...
user avatar
  • 141

1
2 3 4 5 6