As JulianD stated, there are hacks such as vBHome lite that will give you this in a very query-efficient manner. If you are fairly new to PHP coding, I wouldn't create it on your own as the news process itself can develop a huge amount of queries if configured improperly (Teck would probably know).
Also, if you insist on it being original, why are you asking for the code to do it in this thread?