I have a problem, in sorting out records. Here is the table I have got with some of the data
IDSortname AddressBalanceDate
1Chris 10 The street50.0009/10/2013
2Simon 2 The shoe70.0012/05/2013
3BobMy Cottage80.0001/01/2013
4Chris 10 The street65.2501/10/2013
5Chris 10 The street25.2015/10/2013
6Ted2 Avenue40.0005/11/2013
7Tylor The Barn38.0005/11/2013
I need to put the data into the following orders: balance by greatest value first
then group the names together as well. So that all Chris transactions are grouped together.
select ID, Sortname, Address, Balance, Date
from table
where balance < 100.00
group by sortname
order by date, balance desc,
However this does not work as the names are linked together the balances do not go down the page
in a decreasing value.
so should be
IDSortname AddressBalanceDate
1BobMy Cottage80.0001/01/2013
2Simon 2 The shoe70.0012/05/2013
3Chris 10 The street65.2501/10/2013
4Chris 10 The street50.0009/10/2013
5Chris 10 The street25.2015/10/2013
6Ted2 Avenue40.0005/11/2013
7Tylor The Barn38.0005/11/2013
Can anyone point me in the right direction please?
IDSortname AddressBalanceDate
1Chris 10 The street50.0009/10/2013
2Simon 2 The shoe70.0012/05/2013
3BobMy Cottage80.0001/01/2013
4Chris 10 The street65.2501/10/2013
5Chris 10 The street25.2015/10/2013
6Ted2 Avenue40.0005/11/2013
7Tylor The Barn38.0005/11/2013
I need to put the data into the following orders: balance by greatest value first
then group the names together as well. So that all Chris transactions are grouped together.
select ID, Sortname, Address, Balance, Date
from table
where balance < 100.00
group by sortname
order by date, balance desc,
However this does not work as the names are linked together the balances do not go down the page
in a decreasing value.
so should be
IDSortname AddressBalanceDate
1BobMy Cottage80.0001/01/2013
2Simon 2 The shoe70.0012/05/2013
3Chris 10 The street65.2501/10/2013
4Chris 10 The street50.0009/10/2013
5Chris 10 The street25.2015/10/2013
6Ted2 Avenue40.0005/11/2013
7Tylor The Barn38.0005/11/2013
Can anyone point me in the right direction please?