Make sure you give it an name(alias). Create view viewname (ClientID, MxIDJulianHVID) as select Clientid, max(IDJulianHVID) from tablename group by ClientID
Dan Goldberg From: [email protected] [mailto:[email protected]] On Behalf Of Patti Jakusz Sent: Thursday, January 28, 2016 11:11 AM To: Dan Goldberg Subject: [RBASE-L] - Question about views Hi Rbase Pros, I'm trying to learn how to use views. They didn't work very well for me in 1993, so I ignored them until now. I have a table of Home Visits for our clients. I created a view (HVLatestDate) to capture the most recent visit for each client. So I have 2 columns in my view: Client ID (I group on this) IDJulianHVID (I use the Max function) This is a computed field that includes the client, visit date and visit type one field. This part works ok, but if I want to select that computed field from the view, it won't let me. I've tried using the name as it appears above (select IDJulianHVID from HVLatestDate). I tried calling it T1.IDJulianHVID and I've tried calling it (MAX(T1.IDJulianHVID)) and (MAX(IDJulianHVID)). Nothing seems to work. I can select the ClientID field though. But I don't need that one, I need the one I MAXed. I tried the whole view over again using an uncomputed column (Julian) instead of the computed column and it still won't let me select it from the view at the R> prompt. How can I select this column from this view? Thanks, Patti

