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