Unknown column 's' in 'where clause' SELECT typ,foreign_id FROM new_system WHERE system_id = s AND typ = 'kod'