June 30, 2008 at 7:14 am
Hi
I have a query like this :
select x, (SELECT MAX(IL1.[Posting Date]) AS Verkoop
FROM [OPS Sepia$Item Ledger Entry] AS IL1
WHERE ([Entry Type] = 1) AND (IL1.[Item No_] = Item.No_)) AS [datum laatste verkoop],
(SELECT MAX(IL2.[Posting Date]) AS Inkoop
FROM [OPS Sepia$Item Ledger Entry] AS IL2
WHERE ([Entry Type] = 0) AND (IL2.[Item No_] = Item.No_)) AS [datum laatste inkoop]
from...
Now the two query statements are giving a different result. In fact I only want the max of both, like max(select statement 1, selectstatement 2).
How can you do this within t sql ?
Thx in advance.
JV
June 30, 2008 at 7:32 am
so just use a single select and modify your where clause
...[Entry Type] in (0,1)...
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
June 30, 2008 at 7:38 am
why am I looking so stupid now.
So easy, thx !!
Breaking my head already for a week about the rest of the game, don' see the easy stuff anymore 🙂
Many thx !!!
JV
June 30, 2008 at 8:00 am
Aha, the wood and the trees .... :w00t:
Been there, done that 😉
Every once in a while, a good dba needs to proove (s)he's human after all 😛
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply