1

I have to join some attributes of two layers in QGIS (3.22.7). Therefore, I am required to use inner join. When I go to the layer properties of the first layer and join the two layers/tables with a common attribute, then the resultant table had null values which should not be present. For that, I have filtered the null values of that column of the second layer before applying the join. Still, the final table has the null values. Hence, I think the join I am doing is the left join and inner join could be a solution to avoid null values in that column. So, how can I apply inner join in QGIS 3.22.7?

I have to use the following SQL query

SELECT A.ATT1, A.ATT2, B.BTT1
FROM LAYER1 B
INNER JOIN LAYER2 A
ON A.ATT1 = B.BTT2
WHERE B.BTT2 NOT LIKE 'NULL' and B.BTT2 LIKE 'ABC'

I have tried to filter the NULL values with the following command "BTT2" NOT LIKE 'NULL' and "BTT2" LIKE 'ABC' The output is enter image description here

6
  • 2
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Jul 13, 2022 at 6:27
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Jul 13, 2022 at 7:54
  • @IanTurton, thanks for the response. I have now edited my question with some details. Hope it will clarify my problem. Thanks. Jul 13, 2022 at 9:20
  • 1
    please show us the SQL you are using and some example output
    – Ian Turton
    Jul 13, 2022 at 9:25
  • I have added SQL and sample output of the problem Jul 14, 2022 at 1:19

1 Answer 1

1

You can create a virtual layer with the query:

select t1.*
from layername1 t1
inner join layername2 t2
on t1.fieldx = t2.fieldy
0

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.