Faster SQL query

Added a faster SQL query