Hello,
This request return an error:
SELECT MAX(date_loading), n_station FROM Load_station WHERE n_load=238 AND
date_unloading IS NULL
In this request, I would like to know the value of the column n_station of
the record with the biggest date_loading and where n_load=238 and
date_unloading is null.
ThanksSELECT TOP 1 n_station, date_loading
FROM Load_Station
WHERE n_load = 238
AND date_unloading IS NULL
ORDER BY date_loading DESC
"Alan" <Alan@.discussions.microsoft.com> wrote in message
news:E1B83A0A-CC57-4017-BDC7-AB80E3D13E8A@.microsoft.com...
> Hello,
> This request return an error:
> SELECT MAX(date_loading), n_station FROM Load_station WHERE n_load=238 AND
> date_unloading IS NULL
> In this request, I would like to know the value of the column n_station of
> the record with the biggest date_loading and where n_load=238 and
> date_unloading is null.
> Thanks|||Try
SELECT n_station FROM Load_station
WHERE date_loading =
(SELECT MAX(date_loading) FROM Load_station
WHERE n_load = 238 AND date_unloading IS NULL)
"Alan" wrote:
> Hello,
> This request return an error:
> SELECT MAX(date_loading), n_station FROM Load_station WHERE n_load=238 AND
> date_unloading IS NULL
> In this request, I would like to know the value of the column n_station of
> the record with the biggest date_loading and where n_load=238 and
> date_unloading is null.
> Thanks
Monday, February 20, 2012
MAX()
Labels:
anddate_unloading,
database,
date_loading,
errorselect,
load_station,
max,
microsoft,
mysql,
n_load238,
n_station,
nullin,
oracle,
request,
return,
server,
sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment