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: ProFox@leafe.com
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/f8d7009c0911180723o55c9fb37od85c574f77e5d...@mail.gmail.com
** 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.

Reply via email to