Simplified sql