Question: postgresql
--I don't want to have to enter each repeating column, I want syntax in the where clause that checks all the columns and returns only columns with data

```
SELECT *
FROM table_with_200_columns
where datetime between '2021-01-01' and current_date
and column.1 is not null
and column.1 <>''
and column.2 is not null
and column.2 <>''
and column.3-200 is not null
and column.3-200 <>''
;
--something like this with an "presently unknown function" as in the example of 'allofthemtherecolumns'
SELECT *
FROM table_with_200_columns
where datetime between '2021-12-01' and current_date
and allofthemtherecolumns is not null
and allofthemtherecolumns <>''

```

your assistance is greatly appreciated

Answer: 
You solution is pretty good. list/dictionary comprehensions are not always the best approach. But If you insist, you can do something like:

```py
from itertools import groupby

lst = [(1, 'a'), (2, 'b'), (2, 'c'), (3, 'd')]

res = {k: [b for a, b in g] for k, g in groupby(lst, key=lambda x: x[0])}
print(res)

```

output:

```
{1: ['a'], 2: ['b', 'c'], 3: ['d']}

```

**note:** This solution would work if you pass a sorted list, If it's not, make sure you sort the list before using it in the dictionary comprehension (Thanks @Chepner)

```
sorted_lst = sorted(lst, key=lambda x: x[0])

```
What you have is already quite efficient and not that long. It could be converted to a one-liner at the expense of legibility with little or no performance benefit:

like this:

```
dic = next(g  for g in [{}] if not any(g.setdefault(k,[]).append(v) for k,v in lst))

```

Or this:

```
dic = {}; dic.update((k,dic.get(k,[])+[v]) for k,v in lst)

```