yoursurrogategod Posted November 14, 2012 Share Posted November 14, 2012 Hi, I have the following code: SELECT v.account_number_institution AS inst, v.account_number, v.nurse_station, v.discharge_timestamp, s.form_name, s.date_form_modified, s.destination_address, s.destination_description, s.result_message, s.date_sent FROM patient_visits v LEFT OUTER JOIN encounter_form_outgoing_status s ON v.account_number = s.account_number AND v.account_number_institution = s.account_number_institution WHERE v.discharge_timestamp BETWEEN convert(varchar(, getdate() - 1, 1) AND convert(varchar(, getdate(), 1) AND 'TZK' IN ('', v.account_number_institution) ORDER BY v.account_number_institution, v.nurse_station, v.discharge_timestamp DESC, s.date_form_modified DESC, s.form_name, s.date_sent DESC It returns the following results: TZK 000000090316688 2012-11-13 16:12:07.000 NULL NULL NULL NULL NULL NULL TZK 000000090316506 2012-11-13 11:57:08.000 NULL NULL NULL NULL NULL NULL TZK 000000090316522 2012-11-13 11:09:30.000 NULL NULL NULL NULL NULL NULL TZK 000000090316654 3E 2012-11-13 10:44:00.000 NULL NULL NULL NULL NULL NULL TZK 000000090316548 3N3 2012-11-13 13:18:00.000 NULL NULL NULL NULL NULL NULL TZK 000000090316480 CCU 2012-11-13 11:05:15.000 NULL NULL NULL NULL NULL NULL However, when it comes to the discharges that were done today (on the 14th of November), they are not displayed. I don't get it, I thought that this would not be an issue. Am I missing something in my SQL code? How can I get the MS-SQL schema and post it here? Quote Link to comment https://forums.phpfreaks.com/topic/270701-getdate-in-ms-sql-searching-for-a-specific-date/ Share on other sites More sharing options...
yoursurrogategod Posted November 16, 2012 Author Share Posted November 16, 2012 Please ignore this. My whole approach was wrong and with my new way of doing things, these problems went away. Quote Link to comment https://forums.phpfreaks.com/topic/270701-getdate-in-ms-sql-searching-for-a-specific-date/#findComment-1392953 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.