Skip to content

Tag: mysql

Populating a recordset between two positions in a table using MYSQL

I’m trying to write a query that will only return a recordset between 2 positions in a table For example, using Excel to demonstrate, populate a recordset between positions 3 and 7 I thought about using BETWEEN with the ID field, but there may be times that a record has been deleted and the ID field aut…

SQL Get users with max occurrences in table

Given the following table transactions, which records the IDs of sellers and buyers who had a transaction, I would like to determine the user who was involved in the highest number of transactions and …

Get sum of column with distinct id in SQL

I am trying to get sum of the amount on distinct ext_id. Id Ext_id amount 1 234 5 2 234 5 3 235 10 4 236 8 5 236 8 Select SUM(amount) from Table1 — this will get me sum of all  => 36 I want just sum of distinct Ext_id which should be 23. Can someone help me with this?

MySQL – Join tables to a custom list/array of values

I would like to know if it’s possible to join tables into a custom set of values in MySQL. For example, I have a set of dates (outside the database). I would like to get the matched joins in a single query so that I can easily loop through the result. Like: Data outside database Date 2021-04-08 2021-04-…

SQL get total sellers of product category

I have like this database tables: Table categories Table products Table product_varieties I have query to get price min, max and avg in each category: Now I need get total users (sellers) of each category by editing my current query. I tried like this: But my query not work and return error with message: How …