Active Query Builder support area

Left Join unioned group query

Avatar
  • updated
  • Completed

I have created a unioned query that refers to the same table three times

I have then group the whole lot into one set of brackets (see picture)

how do I left join this with the rest of my query

So I end up with something like

Select Something From myBigTable
Left Join (Q union all Q union all Q)

Thanks

Avatar
Andrew Kennard

This is what my object tree looks like and I cant work out how to get something into Main at the top and Left Join it with the Union and give the Union a name and an On condition

Thanks


Avatar
Andrew Kennard

OK I can now see it is probably derived tables just need to work out if the join and name will work

Avatar
Andrew Kennard

OK I have got this to work.

Are there any properties that would indent my derived table a bit more ?

eg

Select Something From myBigTable
Left Join (Q
union all
Q
union all Q)

etc

Avatar

You should try to increase IActiveQueryBuilderX.SQLFormatFrom.IndentInPart value,

it defines the indentation size for derived queries

Avatar

Seems IActiveQueryBuilderX.SQLFormatFrom.GlobalIndent is more suitable.

It indents entire derived table, not only inner parts.

Avatar
Andrew Kennard

The GlobalIndent seems to have no effect

The IndentInPart does have an effect and indents the From parts a bit

Ideally in the future you want an indent for the subquery as a whole i.e everything between the brackets

SELECT F1,G2
FROM xyztable
Inner join .....
left join
-----(Select j1,y2
-----From
-----Where)
Where .... etc

Not urgent