Page 1 of 1

Custom Query - can I use GROUP BY like SQL

Posted: 17 May 2018 19:39
by steveflanuk
I am looking to create a custom query listing all Fact types that I have used in my Project. However, when I request just the name of a Fact I get a row for every use within my project (i.e. all birth entries, all census entries, etc). For example, if I have 100 separate birth facts, I get 100 rows with a fact name of Birth.

Is it possible to use some kind of GROUP BY function like SQL so that it only shows one row per 'fact name'?

Re: Custom Query - can I use GROUP BY like SQL

Posted: 17 May 2018 19:50
by tatewise
No, I don't believe there is a way to do that with a Query. It would need a Plugin.

However, you can use a Fact Query to produce a list of Facts with no other columns, then export that to Excel and on its Data tab use Remove Duplicates.

Re: Custom Query - can I use GROUP BY like SQL

Posted: 17 May 2018 20:54
by steveflanuk
Mike - many thanks for the quick reply as usual.

I'll probably remove the duplicate entries in Excel, I don't think I would need this information enough to warrant going through writing a Plugin for it.

I just wanted to know which Facts I've used so I can check the narrative sentences, rather than going through every single standard Fact - a fair number of which I haven't used. I think the Excel route is probably the quickest and easiest way of achieving what I want.