Hi my code masters, i have setup a table called tbl_RADET below is the image of data's imputed by our data entry clarck.
we have about 12,000 record in this table, the paitentID is duplicated due to different date of facility visit, i want to retrive the record with the most current date, from this table i have use lot of sql statement but i am not geting the desired result, i have also used
- select * from tbl_RADET where ptn_pk ='4020' order by lastdrugpickup desc
please i need your help. thank you

Joseph ThomasRank #1,535 · 1K reputationPosted Apr 12, 2017, 2:31 AM EDT
Khaja MoizuddinRank #270 · 9.4K reputationPosted Apr 10, 2017, 5:40 AM EDT
Khaja MoizuddinRank #270 · 9.4K reputationPosted Apr 10, 2017, 5:53 AM EDT
SELECT TOP 1 * FROM tbl_RADET ORDER BY lastdrugpickup DESCwhere ptn_pk ='4020' is optionalManish KumarRank #1,622 · 956 reputationPosted Apr 10, 2017, 6:27 AM EDT
Abraham OlatubosunRank #2,749 · 510 reputationPosted Apr 10, 2017, 6:29 AM EDT
SELECT TOP 1 * FROM tbl_RADET ORDER BY lastdrugpickup DESCAbraham OlatubosunRank #2,749 · 510 reputationPosted Apr 10, 2017, 7:04 AM EDT
Ramesh BarikRank #3,664 · 401 reputationPosted Apr 11, 2017, 10:54 PM EDT
Manish KumarRank #1,622 · 956 reputationPosted Apr 12, 2017, 3:12 AM EDT
viral22 reputationPosted Apr 12, 2017, 4:23 AM EDT
Satyaprakash SamantarayRank #101 · 21.1K reputationPosted Apr 25, 2017, 10:41 PM EDT
using top in sqlSatyaprakash SamantarayRank #101 · 21.1K reputationPosted Jul 4, 2017, 12:56 AM EDT
SELECT * FROM TableName WHERE id=(SELECT max(id) FROM TableName);Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts