Hi,
I have a panel of data organised as follows:
id1, 1990, 100
id1, 1991, 101
id1, 1992, 100
id1, 1993, 103
id2, 1990, 80
id2, 1991, 90
id2, 1992, 81
id2, 1993, 83
id3..... etc.
Is there any way to -- without re-structuring the data -- write a
query that will return the top two records based on the third column?
Like the max function but for the top two instead of top one. The
desired output would be:
id1, 1993, 103
id1, 1991, 101
id2, 1991, 90
id2, 1993, 83
id3.... etc.
Thanks in advance for your time,
Alan 0 1085 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: starman7 |
last post by:
I have a query that seems to kill the db for our website (causes the
'Too many connections' error).
I would like to avoid this! Is there a way to test the query before the
db goes down? I do not...
|
by: dk |
last post by:
Hi all,
Would appreciate some advice on the following:
I am trying to speed up an Access database connected to a SQL Server
back-end. I know I can use a pass-through query to pass the sql...
|
by: Javier |
last post by:
I have a field type Date/Time that automatically defaults to Now().
I'm having a problem writing a query that will retrieve all the
records for a specific date the user to enters when prompted. I...
|
by: Justin Koivisto |
last post by:
In PHP, I do the following (pseudo code for clarity)...
Query: SELECT distinct(web_contacts.zip) FROM web_contacts WHERE
web_contacts.zip <> ''
Query: SELECT DISTINCT(contacts.zip) FROM contacts...
|
by: VMI |
last post by:
I need to display Access data in a datagrid but the Access table has over 2
million records. Since I can't fill a datatable with all those records but
the user needs to see all of them, how can I...
|
by: NumberCruncher |
last post by:
Hi All,
I am struggling with setting up my first system of tables, forms,and reports, and could use your help!
I am setting up a database to keep track of the production of a produced item. The...
|
by: Lloyd Harold |
last post by:
I'm very new to PHP and attempting to put together a simple script for
retrieving MySQL data of personal records.
The MySQL table I'm using consists of:
0: id
1: name
2: location (an integer...
|
by: wadesharp |
last post by:
I would like to write a query to return nested data. The data has a master, child relationshiop and teh child is linked to the master record through the 3 column (LinkedKey). The reason this is all...
|
by: Alan.Aylett |
last post by:
Hi,
I have some data in panel format:
id1, 1990, 100
id1, 1991, 101
id1, 1992, 99
id1, 1993, 103
id2, 1990, 80
id2, 1991, 83
|
by: Alan.Aylett |
last post by:
Hi,
I have a panel of data organised as follows:
id1, 1990, 100
id1, 1991, 101
id1, 1992, 100
id1, 1993, 103
id2, 1990, 80
id2, 1991, 90
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |