Please see the below example data:
I need to check that flow goes like this 'VitalsAckByEmr' and then 'PatientSelected' and not 'VitalsAckByEmr' and then 'VitalsAcquired'. Please help me how to write a sql query to cheive it. i should compare value after 'VitalsAckByEmr' to be 'PatientSelected'.
Please do the needful.
You're attempting to order the data in your query. You need to define something to order it by. From the example above, can you order by the first column? It looks to be ordered in the fashion you need. The query would look something like this (but with your column and table names, since I don't know what they are, I made something up).
This query will retrieve the description column from the table, but it will order it by the first column (ID). It will do this in an ascending manner (ASC), counting up.
answered Aug 13 '12 at 06:21 PM
Grant Fritchey ♦♦
Here's an alternative approach.
If you've got a unique value to track a particular patient through this system (eg a PatientID), then you might consider this approach:
That brings back the following results:
If you want to specifically select those PatientID records that don't match the above process, I've added the following records to the @VitalData table:
and you can add a
and this time, we get:
Just an idea, mind...
answered Aug 14 '12 at 08:02 AM
This might work but would need testing to make sure it scales past 2 records...