I am trying to return the top 2 dates and values for each empi. If I ran Select T1.empi, t1.date, t1.value
FROM plmCombinedLab as T1
Where T1.Date IN (SELECT TOP 2 T2.DATE FROM plmcombinedlab As T2 Where T1.EMPI = T2. EMPI ORDER BY T2.EMPI)
would this return the correct top 2 lab values for...
Hello,
I am getting the following error message when tryin to run the code listed below:
Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.
Code:
SELECT T1.EMPI, T1.DATE, T1.VALUE
FROM plmCombinedLab AS T1
WHERE T1.EMPI IN
(SELECT TOP 2 T2.Date...
I'm trying to return one of two values if a person has a BMI>25 or if they have a weight of >210 I would like the true value to return. The following code returns BMI when neither of the above criteria is true. How can I return only the true value?
Expr3: IIf([Weight]>="210" And [BMI]>="25"...
Yes, thank you. Here is what the query returned:
MRN Login_Date_Time
00036871 7/9/2002 10:27:00
00036871 9/15/2003 13:15:00
When I open the table, this MRN contains the following rows:
MRN Login_Date_Time
00036871 10/1/2002 10:20:00 AM
00036871 7/9/2002 10:27:00 AM
00036871 1/7/2002...
Thank you for the suggestions. I originally had a Group By in the query because of the Max function I tried. I just tried the above referenced code and still the same result as before. I am using a passthrough query to my SQL database, could that have anything to do with the reason why I am...
hI,
Here is the latest :
SELECT EE. MRN,EE.NAME,LABS.Login_Date_Time
FROM EE
INNER JOIN LABS ON LABS.MRN = EE.MRN
AND LABS.Login_Date_Time IN
(SELECT Top 2 Login_Date_Time FROM LABS WHERE EE.MRN = LABS.MRN GROUP BY EE.MRN,
LABS.Login_Date_Time ORDER BY Login_Date_Time DESC);
Thank you. This works great, but I am not getting the Top 2 that I wanted. This is giving me the first two records in the sub query without selecting the top 2 by date. I thought it would start with the latest date, then the sencond latest date. Any suggestions?
Thank you.
Hello,
I have a table called Labs and a table called EE's. Each EE has many labs in the lab table. I am trying to figure out how I find the top 2 labs (based on date) and return that along with all of the fields in the EE table. Would I use a sub query?
Something like this? SELECT * FROM ee...
Hello,
I have a table called Labs and a table called EE's. Each EE has many labs in the lab table. I am trying to figure out how I find the top 2 labs (based on date) and return that along with all of the fields in the EE table. Would I use a sub query?
Something like this? SELECT * FROM ee...
I tried the code
Private Sub Form_Open(Cancel As Integer)
Me.Filter = "EMPI = " & Forms!Contact!EMPI
Me.FilterOn = True
End Sub
and I am getting an error "missing operator in query expression". Any suggestions?
Thank you.
Hello,
I have a form with a button on it. I would like the button to open a second form when clicked. The problem I am having is linking the second form to the record in the first form. This is not a sub form/form example, they are two seperate forms.
Can this be done.
Thank you.
I have an Access form with a button on it that opens a sub form. I cannot get the sub form to open linking to the record id on the first form. Any suggestions?
Here is the code I use to open the sub form:
Private Sub Command178_Click()
On Error GoTo Err_Command178_Click
Dim stDocName As...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.