Good evening, is there an analogue of the operator MySql: = in Sqlite, just have a query, if there is one?

SELECT DISTINCT NamePrefix, MiddleName, Surname, @curField := FieldTypeId AS FieldTypeId, (SELECT GROUP_CONCAT(ValueTypeId) FROM Field WHERE FieldTypeId = @curField) AS ValueTypeId, (SELECT GROUP_CONCAT(Value) FROM Field WHERE FieldTypeId = @curField) AS Value FROM ` FieldsToContact` INNER JOIN `Field` ON FieldsToContact.FieldId = Field.Id INNER JOIN `Contact` ON FieldsToContact.ContactId = Contact.Id 
  • Eprst ... Well, you can not lay out the code like that! : o And, as far as I know, SQLite is compatible with MySQL commands. - user189127
  • when added to the query: = a crash occurs, where the sqlite swears at the symbol: - Contact
  • Try just a = - hardsky
  • no, not that, then returned fields equal NULL - Contact
  • Why do you need a variable here? why not write a subquery in the form of a SELECT GROUP_CONCAT(ValueTypeId) FROM Field WHERE Field.FieldTypeId = FieldsToContact.FieldTypeId ? - Mike

1 answer 1

SQLite does not support the creation of variables (discussion here ).

If you really need variables, then there is a description of how to achieve a similar effect using a temporary table, but in general it is easier to rebuild the query, as suggested by Mike in the commentary on the question, or to perform several queries, saving variables in the code.