Why this query is not working:-
SELECT b.byhub,
Count(awbno)
FROM (SELECT awbno,
byhub,
entrydatetime,
Max(entrydatetime)
FROM wbbooking
GROUP BY awbno,
byhub,
entrydatetime) B
INNER JOIN (SELECT refno,
Max(entrydatetime)
FROM wbmmreceiving
GROUP BY refno) R
ON B.awbno = R.refno
WHERE CONVERT(DATE, b.entrydatetime) BETWEEN '2016-10-13' AND '2016-10-13'
GROUP BY b.byhub
After Execute this query I have obtain this type of Error:-
Msg 8155, Level 16, State 2, Line 2
No column name was specified for column 4 of 'b'.
Msg 8155, Level 16, State 2, Line 3
No column name was specified for column 2 of 'r'.
entrydatetime, what are you expectingMax(entrydatetime)to yield?