thanks for taking the time. I have the following query: Which gives me the results I want which are the distinct ‘bike_id'(as there are no duplicates), the count of all the rides each ‘bike_id’ made in 2017, and the quick average for the year for each ‘bike_id’. From here, id lik…
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
Trigger in SQL causing error “Product_Reorder is not a recognized SET option”
I am not getting a syntax error syntax error near ; This is referring to the ; at the end of the code. Answer Not 100% sure what you’re trying to do – you’re not giving us much to go on, either! I’m assuming you mean you want to set a column called Product_ReOrder in your table to 1 if
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:/…
Selecting values from second column alongside the values from first column in the same row
I am trying to get values matching the value from the second column. For example, I want to know who is the sender for Bill Gates by only using IDs. I have two tables, I want to select based on “user_receiver” column the matching values in the column “user_sender” For example, I want t…
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…
BigQuery – How to select the first campaign each user clicked on?
Let’s imagine that I have a website that sells electronics. In order to attract customers, I invested some money in online ad campaigns. The following table has three columns: user_id (id that identifies each user), event_date (the date when the user clicked on the ad) and mkt campaign (the name of the …