I have two layers containing points. I want to draw lines from each point of layer Quellen to each point of layer Ziele. Layer Quellen has an ID called q.id, Layer Ziele has an ID called z.id.

attribute tables

I have already found multiple Questions here that somehow solve this problem, using a virtual layer with the query

select a.id, b.id, makeline(a.geometry, b.geometry) as geometry
from myLayer a, myLayer b

which I took and edited to fit my names in two ways already

select q.id, z.id, makeline(a.geometry, b.geometry) as geometry
from Quellen, Ziele
select q.id, z.id, makeline(q.geometry, z.geometry) as geometry
from Quellen, Ziele

(I was not sure, if a.geometry is a fixed variable or depending on the id name)

But the test of my virtual layer is already failing at finding column "q.id" error message

What am I doing wrong here? I am not sure if I actually need any IDs at all as I want to draw a line from each object of layer Quellen to each object of layer Ziele. IMO that should not depend on any ID. Maybe there is another approach to achieve that?

  • it should be something like: "select Quellen.q.id, Ziele.z.id, makeline(Quellen.geometry, Ziele.geometry) as geometry from Quellen, Ziele" and I would avoid points in your column names
    – eurojam
    Mar 7, 2023 at 7:05
  • tried that, now it says "Query preparation error on PRAGMA table_info(_tview): no such column: Quellen.q.id" its not the points either as i have also already tried qid and zid
    – e-shirt
    Mar 7, 2023 at 7:11

1 Answer 1


You miss the aliases for the layer names (q and z) and the points in the column names are interfering with the layer.column syntax.

Try this:

select q."q.id", z."z.id", makeline(q.geometry, z.geometry) as geometry
from Quellen q, Ziele z
  • Thanks! Just tried that, I am still getting the same error (no such column: q.id)
    – e-shirt
    Mar 7, 2023 at 8:30
  • I got your column names wrong (I missed the q. / z.), perhaps my edit with the quotation marks works?
    – Matt
    Mar 7, 2023 at 8:32
  • Passed with no errors and works! Thanks a lot :)
    – e-shirt
    Mar 7, 2023 at 8:34
  • 1
    Nice. I added a little clarification to my answer for future readers
    – Matt
    Mar 7, 2023 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.