Skip to content
Advertisement

Tag: select

SQL Server: show string majority

I am looking to make a query in SQL SERVER that will allow me to display in a grouping the string that appears in most cases. Not the amount, not the maximum, but the string that is displayed in most cases: colA colB colC A 10 ccc A 20 aaa A 35 bbb A 25 aaa A 10 aaa B

REACT: SELECT from MYSQL

i a new user and a new in React world. I need help to solve this situation about a Select with values from mysql DB. I receive the values, but the select goes in infinite loop. The error is surely in this file cause server.js works without problem!! Really thanks for the help, and sorry if it could be a

Dates returned as columns in SQL Select

My user will submit a FromDate and a ToDate. What I want to happen is to select the dates that fall in between these dates, which I have accomplished with the script below. The dates will by dynamic. This returns that dates as rows. What I am looking for is a way to make these dates return as the columns

Select Distinct Rows with complex criteria

I have a table generated from a CRM software and it has a lot of repited individuals in different rows but with different fields completed in each repetition, something like this: id birth_date sex postal_code customer smoker 001 NULL NULL 00067 Yes 1 001 NULL Male 00067 NULL 1 001 21/03/1994 NULL 00067 NULL NULL 002 NULL Female NULL NULL

SQL – combined SELECT queries and getting a % output

I am using SQLiteStudio and I am trying to run the following query. However, it isn’t returning a value. Can anyone help, please? I have been asked to provide some of the data. Below I have included how I created my 3 tables and then some sample data for each section. Hopefully, this is enough but feel free to ask

Calculate total difference of values between two timestamps

DB-Fiddle Expected Result: I want to calculate the total difference of the quantity between two timestamps. Therefore, I tried to use the query from this question: However, I am not able to get the expected result. What do I need to change to make it work? Answer The partition by clause in the lag call of your query is redundant.

Case statements with Join on lookup

I have a big table with some columns having lookup values. I want to create a description column for each lookup column and populate them with description from lookup table. Here is one example main table id1 id2 id3 1 2 3 1 3 4 look up table code id desc id1 1 id1-desc1 id2 2 id2-desc2 id2 3 id2-desc3

Advertisement