There are several posts (1)1), 2)2)) and manuals to create a spatial view within a Spatialite Database and to work with it in QGIS.
The important thing is to register the view in geometry_columns table:
INSERT INTO views_geometry_columns
(view_name, view_geometry, view_rowid, f_table_name, f_geometry_column)
VALUES ('italy', 'geometry', 'ROWID', 'local_councils', 'geometry');
All examples are about views which were created from one table.
How I have to register this view?
CREATE VIEW photo_object AS
SELECT a.id, MakeLine(b.geom, a.geom) AS geom
FROM object a, photo b
WHERE a.id=b.id