|
max(titapedate), tisystem, TILable, tilocate from tapeinv00 where tisystem = 'RG' and TIlabel =
'FRIDAY' and tilocate = 'VAULT' )
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Dan Kimmel
Sent: Tuesday, November 26, 2013 1:42 PM
To: Midrange Systems Technical Discussion
Subject: RE: sql max help
Another way around is a multiple column subquery:
SELECT TISEQ FROM tapeinv00 WHERE (titapedate, TILabel, tilocate) IN
(select
max(titapedate), TILable, tilocate from tapeinv00 where tisystem = 'RG'and TIlabel =
'FRIDAY' and tilocate = 'VAULT' )
-----Original Message-----a
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Smith, Mike
Sent: Tuesday, November 26, 2013 1:01 PM
To: Midrange Systems Technical Discussion (midrange-l@xxxxxxxxxxxx)
Subject: sql max help
I have a table with the following
TISYSTEM TILABEL TILOCATE TISEQ TITAPEDATE
RG FRIDAY VAULT 1 20,130,614
RG FRIDAY VAULT 2 20,130,524
RG FRIDAY VAULT 3 20,130,531
RG FRIDAY VAULT 4 20,130,607
RG MONDAY VAULT 1 20,130,614
RG MONDAY VAULT 2 20,130,524
RG MONDAY VAULT 3 20,130,531
RG MONDAY VAULT 4 20,130,607
I am trying to get the value of TISEQ for the record with the highest date for
specific system, label, locationconfidential
So I have the following query and it works fairly well, except I seem to get
two records back
SELECT TISEQ FROM tapeinv00 WHERE titapedate = (select
max(titapedate) from tapeinv00 where tisystem = 'RG' and TIlabel =
'FRIDAY' and tilocate = 'VAULT' )
What I would hope to get for this query is 1
I get two records with 1 returned and I'm not sure why.
Ideas?
Better way to do this query?
Thanks
Mike
NOTICE: This message, including any attachment, is intended as a
and privileged communication. If you have received this message in error,or
are not the named recipient(s), please immediately notify the sender andlist
delete this message.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.