Never mind ... please move along... nothing to see here...
The Oracle DBA that I work along side at work solved my problem:
SELECT * FROM LPMHistory a WHERE a.Cycle in
( SELECT TOP 1 b.Cycle FROM LPMHistory b GROUP BY b.Cycle, b.DTime WHERE
b.DTime > CTOT( GETWORDNUM( JUSTSTEM( JUSTPATH( CURDIR())), 1) + [T] +
STUFF( GETWORDNUM( JUSTSTEM( JUSTPATH( CURDIR())), 2), 3, 0, [:])) - 180
ORDER BY b.Cycle, b.DTime)
G.
On Wed, Nov 18, 2009 at 15:23, Garry Bettle <[email protected]> wrote:
> Hi Everyone,
>
> Hope this email finds you all well - roll on the weekend.
>
> I have a query that isn't working at the moment - it returns, "SQL:
> Subquery is invalid"
>
> The subquery works fine on it's own:
>
> SELECT TOP 1 b.Cycle, b.DTime
> FROM LPMHistory b
> GROUP BY b.Cycle, b.DTime
> WHERE b.DTime > CTOT( GETWORDNUM( JUSTSTEM( JUSTPATH( CURDIR())), 1) +
> [T] + STUFF( GETWORDNUM( JUSTSTEM( JUSTPATH( CURDIR())), 2), 3, 0, [:])) -
> 180
> ORDER BY b.Cycle, b.DTime
>
> It returns a cursor:
>
> Cycle Dtime
> 71 25/09/2009 22:37:01
>
> Now, > 1 record exist in LPMHistory with Cycle = 71 that I thought I could
> fetch by wrapping the above SQL as so:
>
> SELECT * FROM LPMHistory a
> WHERE a.Cycle in ( SELECT TOP 1 b.Cycle, b.DTime FROM LPMHistory b
> GROUP BY b.Cycle, b.DTime WHERE b.DTime > CTOT( GETWORDNUM( JUSTSTEM(
> JUSTPATH( CURDIR())), 1) + [T] + STUFF( GETWORDNUM( JUSTSTEM( JUSTPATH(
> CURDIR())), 2), 3, 0, [:])) - 180 ORDER BY b.Cycle, b.DTime)
>
> but this doesn't work.
>
> Any ideas?
>
> Many thanks!
>
> Cheers,
>
> Garry
>
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.