Skip to content
Advertisement

Tag: mysql

Creat procedure in mysql

I was learning sql from w3schools.Here is given simple mysql procedure but somehow I couldn’t to write down this procedure I’m new in sql please could you provide me with feedback. DELIMITER // …

Slow Moving Stock Items Query

I am trying to return a list of slow-moving stock items. Whenever there is a sale, the items are written to the saleItems table. I want to get those items from inventoryMaster table that are not …

get the count of unread messages

I have this requirement with our DB like shown below I want to get the 3 columns requestType, CategoryGroup, and count of readStatus column The result will show all the requestType along with …

SQL GROUP_CONCAT query assistance

I am having some problems figuring out the best use of GROUP_CONCAT. In the query below I am trying to select multiple images from JAM_Plot_Images and set them against single records. So get record …

PDO changes query

I want to have result of my query as it was before I replaced db connection using PDO. How can I get the query as i t was before I implemented PDO? This is my query: $query = “SELECT `…

How do I find the 2nd most recent order of a customer

I have the customers first order date and last order date by doing MIN and MAX on the created_at field (grouping by email), but I also need to get the customers 2nd most recent order date (the order date right before the last orderdate ) Answer Use window function ROW_NUMBER() (available in MySQL 8.0): This will get you the earlierst

Advertisement