Select me. The address as the address, the me totalChecked as totalChecked, me. Avatar as avatars, info. Checked as checked, the info. CheckedTime as checkedTime, info. UpvoteNumber as upvoteNumber, info. The username as username
The from (select are. Address is. TotalChecked, is. The avatar, is. The username
The from Member is
Where are the status=0) as me
Left the join (
The select checkDayInfo username, checkDayInfo checked, checkDayInfo. CheckedTime, checkDayInfo. UpvoteNumber
The from CheckDayInfo CheckDayInfo
Where checkDayInfo. Date='2020-04-17'
) as the info
On me. The username=info. The username
The order by the info. Checked desc, info. CheckedTime asc
CodePudding user response:
You write is too messy, dazzling, provides a train of thought for youIF OBJECT_ID (' QUERY_DATAS) IS NOT NULL
DROP TABLE QUERY_DATAS
GO
WITH QUERY_DATAS AS
(
SELECT 1 A, 2 B, 3 C
1) SELECT the FROM QUERY_DATAS
Use WITH CTE AS can solve your problem, AS take out, eyes ache