I need to order my table first BY name alphabetically and then within the name the date must be most recent first
我需要先按字母顺序排列我的表,然后在名称中,日期必须是最近的
here is what ive tried:
这是我试过的:
select ME_BORROWER.ABN_BOR_NO, ME_BORROWER.ABN_BOR_NAME, ABN_ACCESS_NO, ABN_LOAN_DATE
from ME_BORROWER LEFT OUTER JOIN ME_LOAN ON
ME_BORROWER.ABN_BOR_NO = ME_LOAN.ABN_BOR_NO
where ABN_TOWN='Leicester' or ABN_TOWN='Hinkley'
GROUP BY ME_BORROWER.ABN_BOR_NAME
ORDER BY ABN_LOAN_DATE asc;
3 个解决方案
#1
3
How about:
如何:
ORDER BY ABN_BOR_NAME ASC, ABN_LOAN_DATE DESC
#2
1
This should work...
这应该工作……
select P17192142_BORROWER.ABN_BOR_NO, P17192142_BORROWER.ABN_BOR_NAME, ABN_ACCESS_NO, ABN_LOAN_DATE
from P17192142_BORROWER LEFT OUTER JOIN P17192142_LOAN ON
P17192142_BORROWER.ABN_BOR_NO = P17192142_LOAN.ABN_BOR_NO
where ABN_TOWN='Leicester' or ABN_TOWN='Hinkley'
ORDER BY ABN_BOR_NAME, ABN_LOAN_DATE DESC
#3
1
Your query would be clearer with table aliases and the in
operator:
使用表别名和in操作符可以更清楚地查询:
select b.ABN_BOR_NO, b.ABN_BOR_NAME, l.ABN_ACCESS_NO, l.ABN_LOAN_DATE
from P17192142_BORROWER b LEFT OUTER JOIN
P17192142_LOAN l
ON b.ABN_BOR_NO = l.ABN_BOR_NO
where b.ABN_TOWN in ('Leicester', 'Hinkley')
order by b.ABN_BOR_NAME, l.ABN_LOAN_DATE desc;
The GROUP BY
seems unnecessary.
这个团体似乎没有必要。
#1
3
How about:
如何:
ORDER BY ABN_BOR_NAME ASC, ABN_LOAN_DATE DESC
#2
1
This should work...
这应该工作……
select P17192142_BORROWER.ABN_BOR_NO, P17192142_BORROWER.ABN_BOR_NAME, ABN_ACCESS_NO, ABN_LOAN_DATE
from P17192142_BORROWER LEFT OUTER JOIN P17192142_LOAN ON
P17192142_BORROWER.ABN_BOR_NO = P17192142_LOAN.ABN_BOR_NO
where ABN_TOWN='Leicester' or ABN_TOWN='Hinkley'
ORDER BY ABN_BOR_NAME, ABN_LOAN_DATE DESC
#3
1
Your query would be clearer with table aliases and the in
operator:
使用表别名和in操作符可以更清楚地查询:
select b.ABN_BOR_NO, b.ABN_BOR_NAME, l.ABN_ACCESS_NO, l.ABN_LOAN_DATE
from P17192142_BORROWER b LEFT OUTER JOIN
P17192142_LOAN l
ON b.ABN_BOR_NO = l.ABN_BOR_NO
where b.ABN_TOWN in ('Leicester', 'Hinkley')
order by b.ABN_BOR_NAME, l.ABN_LOAN_DATE desc;
The GROUP BY
seems unnecessary.
这个团体似乎没有必要。