Linked Questions

1359 votes
34 answers
1.3m views

There is a table messages that contains data as shown below: Id Name Other_Columns ------------------------- 1 A A_data_1 2 A A_data_2 3 A A_data_3 4 B ...
Vijay Dev's user avatar
  • 27.6k
76 votes
6 answers
163k views

Let's say I have a table called messages with the columns: id | from_id | to_id | subject | message | timestamp I want to get the latest message from each user only, like you would see in your ...
user1019144's user avatar
  • 1,263
41 votes
6 answers
228k views

I have a table where each ID is repeated 3 times. there is a date in front of each id in each row. I want to select entire row for each ID where date is latest. There are total 370 columns in this ...
Earthshaker's user avatar
7 votes
4 answers
16k views

The initial table is like this: Fruit | Item_ID | Production_line | Amount_produced | Production_date --------------------------------------------------------------- Apples | 652 | 1 ...
Alen Šimunic's user avatar
2 votes
4 answers
32k views

Say I have a table Table Plays date | track_id | user_id | rating ----------------------------------------- 20170416 | 1 | 1 | 3 (***) 20170417 | 1 | 1 | 5 20170418 ...
sradforth's user avatar
  • 2,186
0 votes
2 answers
19k views

I would like to perform a query that will select only the most recent item from a given group. In this example, I'm tracking vans: Each time they return to base, a check-in is recorded with ...
Attie's user avatar
  • 7,097
3 votes
5 answers
9k views

this is my table name tblPE PEID |idnum | PE_DATE_EXAM | ATTENDANCE 1 | 39 | 2014-08-01 | PRESENT 2 | 42 | 2014-08-10 | ABSENT 3 | 39 | 2014-08-...
Strong Man's user avatar
2 votes
1 answer
12k views

How do I select from a database table a user id that is linked to the minimum value of the table for example User ID Pending ------- -------- 0 5 1 4 2 7 '$...
trecoolable's user avatar
1 vote
4 answers
10k views

This is my current data in database. ======================================== id | IC |date |time | 1 | test |2017-07-27 |14:19:26 | 2 | test |2017-07-...
ron's user avatar
  • 175
3 votes
3 answers
1k views

I'm learning SQL and have been going through the chapters of the GalaXQL app. I've written the following query in answer to the question "Hilight the star (or stars) which has the planet with the ...
AidenWebb's user avatar
  • 599
1 vote
2 answers
5k views

I have joined a few tables in a MySQL query and they are linked by employee id number. The ID number is unique in tables A and B but have multiple rows in table C with a date (stored as a string) ...
Kirk Logan's user avatar
0 votes
1 answer
5k views

I've got a database full of weather data...specifically the date, max temp, min temp, and daily rainfall for more than 100 years. I'm trying to find the maximum temperature for each day and the ...
Jason Dunn's user avatar
0 votes
3 answers
2k views

I have a table with data like the following: Name, City, LastUpdated. I want to get all the data from table distinct by name but only record where last updated is latest. For e.g. if there are 2 ...
Greatchap's user avatar
  • 392
3 votes
2 answers
4k views

this one is driving me to drink so I would love some help. I've got a table with: act_Address, act_OrderID, act_Date I'm trying to get the first act_Date for each address we shipped to. Here's what ...
Kevin Phillips's user avatar
0 votes
1 answer
4k views

select countrycode,name, max(population) from city group by CountryCode LIMIT 0, 1000 Error Code: 1055. Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column '...
arihant singh's user avatar

15 30 50 per page
1
2 3 4 5
47