Skip to content

Sorting out similar values in the same column SQL

I’m trying to categorize data that seem to similar from my database table. Here’s how the table looks like id account 1 011 2 11 3 023 4 23 5 456 I need a select query that will categorize my …

ASP classic select date BETWEEN dates on SQL Server

I run the next query in my classic asp code and it run perfect. it returns results between the days “from” and “to” However,I cannot find out what is wrong with the next query: I want it to return the results of the last week that are recorded in the database. Any Ideas? The query is o…

Display all matched records using Oracle Query

I have query in Oracle using Connect by Level to display all matched records with regexp_substr but it doesn’t display all, I need to change the Connect by Level from +1 to +8 to get all the result. …

SQL – How to print calculated datetime result

If a.modified_datetime is ‘2021/10/01 13:00:00’ and b.modified_datetime is ‘2021/10/01 12:30:00’, the result of this query would be: However, I run this query via sqlplus, it returns What’s wrong with this query, or need to set some options to sqlplus? Answer it is stored in a da…

C# select SQL query with parameter

I would like to migrate database from MS Access to SQL Server and I’m trying to modify my SQL queries. In MS Access they worked. I have this C# code: Connection method : SQL query is working but not returning rows. I guess that problem is a syntax of parameter in query. Can someone direct me? Answer You…

Get percentage of total using sub selection

I have a query that sums sold units and groups them by store. See code and/or SQL-fiddle below: http://www.sqlfiddle.com/#!5/95f29/6 However, I also want the percentage sold by each unit to the total and have therefore created a column named “sold_total”. After the output of this query is generate…