AI OnAI Off
Join tblWorkPage and tblWorkProperty and filter on fkPageID in in tblWorkPage and the primary key for the version number. tblProperty has another level which is tblPageLanguage, for different languages, that does not exist in tblWorkPage (since a single version can't have multiple languages).
Understand that if you do this, you will not get fetched properties, which might be a problem. If you have a page that is fetching its content from another page, this will not be reflected in the database. This is done at the API level.
We had that exact problem here:
http://world.episerver.com/Templates/Forum/Pages/Thread.aspx?id=40816&epslanguage=en
EPiServer went straight to the database for their search indexing, and it created a bug.
I am working on a temporary administrative tool and need to scan all properties on a page given its pageid and workpageid. It is just a small windows forms program so my first thought was to read from the database directly without worrying for web context etc. But I am confused over the tables tblProperty and tblWorkProperty. How do I find the post that relate to a certain pageid and workpageid?