Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
alancarl07
Starting Member
3 Posts |
Posted - 2002-01-23 : 02:08:41
|
Hi, I am not too familiar with sql... but i am trying to write a nested query to filter out information from a table. The problem is that i am trying to use the max function on an excuted query(which has filtered data from two tables). In esence i am trying to perform a query which stores the generated sql in a temp table, and from that table i can operate the max fucnction on it.Thanks |
|
Nazim
A custom title
1408 Posts |
Posted - 2002-01-23 : 02:17:36
|
Something like this should help you .select max(fieldname1)from (select ... .................) aorselect max(fieldname) from tablea ainner join tableb bon a.pkey=b.pkeywhere........if you have a specific query post it. Team members will help you.--------------------------------------------------------------Dont Tell God how big your Problem is , Tell the Problem how Big your God is |
 |
|
alancarl07
Starting Member
3 Posts |
Posted - 2002-01-23 : 02:39:28
|
SELECT Max(tblEventTypeID.order) FROM (SELECT tblEvents.AreaCodeID, tblEventTypeID.Order FROM tblEventTypeID, tblEvents WHERE tblEventTypeID.EventTypeID=tblEvents.EventTypeID AND tblEvents.AreaCodeID = 1);I Got the max function to work,.... now instead of the higlighted text... i need areacodeid is work like thisSelect distinct areacodeid from tblEventswhich should return me a list of area code id's ... and i want this to run as a loop... to pick each id and perform this query in a loop format... |
 |
|
|
|
|