Sorry for posting and wasting time it looks like I have done it after trying 
out a function.  Thanks anyway, have a good Friday.  

cheers
Martin

P.S. heres my Q if you are interested.
SELECT DISTINCT T_ACCESS.S_ORG_TYPE, GETD1(1,'2006',S_ORG_TYPE) AS D_D1, 
T_ACCESS.D_D2, T_ACCESS.D_D3, T_ACCESS.N_ORG_ORDER
  FROM T_ACCESS T_ACCESS
  WHERE T_ACCESS.N_ACCESS_TYPE = 1
  AND T_ACCESS.S_YEAR_APPLY = '2004'
 ORDER BY T_ACCESS.N_ORG_ORDER ASC


>Ok I hope someone can help me with this.  What I have is one table with
>rows as below
>
> 
>
>org_type | year |             d_1 |                 d_2 |
>d_3
>
>adm                              2004     01/01/2004        22/06/2004
>12/12/2004 
>
>adm                              2006     31/01/2006        12/05/2006
>12/12/2006
>
> 
>
>What I want to get is d_2 and d_3 for all orgs for one year and d_1 for
>all orgs for another year, all in one row.  so the results would look
>something like this something like this
>
> 
>
>adm - d_1(where year = 2006) - d_2(where year = 2004) - d_3(where year =
>2004)
>
>imp - d_1(where year = 2006) - d_2(where year = 2004) - d_3(where year =
>2004)
>
>exp - d_1(where year = 2006) - d_2(where year = 2004) - d_3(where year =
>2004)
>
>etc...
>
> 
>
>What is the best way to do this, in the query not the front end?  
>
> 
>
>I used a subselect from query to get the d_1 for 2006 but it returns 2
>rows for each org_type: one for 2004 and one for 2006.
>
> 
>
>Hope this makes sense to someone.
>
> 
>
>I am thinking of using a function possibly to get d1 for type.
>
> 
>
>Thanks for reading.
>
>cheers
>
>Martin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232691
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to