Trying to find code that will allow me to count first names by group, and then return the name with the lowest count.
Sample data:-
PersonGroup FirstName
------------------------
A Bob
A Mary
A Bob
A …
I have a column ride_distance_km and I've tried the following:
SELECT ride_distance_km
FROM ride_data
HAVING ride_distance_km BETWEEN 1.1*min(ride_distance_km) and 0.9*max(ride_distance_km);
Query is running, but I get 0 results which is…
I had this table
A B
1 1H
2 1H
1 1G
1 1E
I need update on this table column A, that take max(a) group by B having count(*) = 2.
Result will be like this:
A B
2 1H
2 1H
1 1G
1 1E
I am working on a mock database for a school project and
I have two tables: CUSTOMERS AND ORDERS
Both tables look like this
CUSTOMERS: custID, custLName, custFName, custAddress, custTown, custPostcode, custPhone, custEmail
And
ORDERS: orderID,…
image of what I want
I have tried the join on x or y and it didn't work, even the group by didn't work.
What almost gave me the result is the query below
SELECT A.Id ,A.AccNo ,A.Name ,B.Id ,B.AccNo1 ,B.AccNo2 ,B.Name
from Table1 as A
left…
query to extend the valid_till date for a month of tenants who have referred more
than two times
sample data:
ref_id referrer_id referrer_bonus_amount referral_valid valid_from valid_till
263 5 2500 1 2015-07-05 2015-09-05
264 3 2500 …
I have a table with columns
id date title
I want to get the list of total occurrences of each title per date. So for example get:
date title total
20 Apr - My Title A - 3
20 Apr - My Title B - 2
21 Apr - My Title A - 5
22…
I have following tables for an SQL test; See SQLFiddle here
> SELECT * FROM `Movie`;
+-----+-------------------------+------+------------------+
| mID | title | year | director …
I have a question on a homework assignment where I need to list the quiz number and date of those quizzes that have a low score less than the average low score.
To do this I need to use a GROUP BY clause and a HAVING clause. It should look something…
I'm faced with a table of player which looks like so:
image of table here:
I'm trying to return the players who play for an above average total playing time, I tried using WHERE in place of HAVING but I got a syntax error. My code just returns one…
so I have made a select query like this:
select distinct
f.[film name]
,f.city
,case rt.[type name]
when 'director' then p.[participant name] else null end 'partecipant name'
,case rt.[type name]
when 'director' then…
I have a table named Messages where one entry contains the same as the following:
longtitude = 4.867478333333334
latitude = 52.31819833333334
username = 'pb'
If I query on the table with the…
I ran this query:
When i deployed the code i realised it was not given me the needed result. WHAT I WISH TO ACHIVE: GET users WHOOSE email APPEAR IN studentusers and useractivation ON THE CONDITION THAT IT THE EMAIL APPEAR IN useractivation WITH…