Skip to content

Tag: sql

Removing count column from query output

Bsically, I’m trying to get the top 5 most rented but don’t want the actual count column as output only as a means of ordering the output. Is this possible? Answer You can try remove the count column and give the formula to order by part: My test: Select for MS SQL Server 2017: Output: col1 A B

Check if string contains user-defined substring using SQL LIKE operator

Basically I have a table like this: movieId name 1 White chicks 2 Inception 3 The Avengers: Endgame 4 Avatar: The Last Air Bender My job is to retrieve all relevant movies based on a substring of the movie name. For example, if a user enters a substring such as “av” (e.g., they enter “http:/…

SQL Server service can not execute in centos

I want to install SQL Server on centOs. I initial this service by command When I get status of service, I get this error: Failed to start Microsoft SQL Server Database Engine /var/opt/mssql/log/ I checked this location to see errors from SQL Server, but this location is empty. Can you help me? Answer Larnu, T…

Join count query into one

I have two very simple count queries that I would like to join into one. To clarify the situation I will add the tables I got: Book isbn author 1111 GB 2222 DC 3333 RL Author code Name GB George B. KL Kyle L. DC Donald C. RL Roland L. Coauthor name isbn KL 1111 GB 2222 GB 3333 And

get all the tables within a date range

I have many weekly backup tables of the same structure and columns but with different names containing some user-specific information like this. Now I want to find the tables within a date range for example: If I choose the date range of 2021-11-20 to 2021-11-13 then the tables fetched would be user_details, …

MS Access Pivoting Query Result Rows into Columns

I’m new to working with MS-Access reports. I have a query that returns the results of employees timesheets, grouped by both month and paycode. I’d like to make a report showing the the following Employee OT Shifts Jan Regular Shifts Jan OT Shifts Feb Regular Shifts Feb 1234 1 1 2 1 5678 5 2 1 0 Ho…