Perry Smith schreef op ma 15-08-2022 om 08:49 [-0500]: > I like to have what I call “baby sitting” messages such as “Completed > 15 out of 1023”. To do this, I need the number of results a query > returns but I also need the results. > > Currently I’m doing this with two queries such as: > > SELECT COUNT(*) FROM table WHERE …. expression … > SELECT * FROM table WHERE …. expression … > > But this requires two queries. Is there a way to do the same thing > with just one query somehow? > > I’ve been toying with row_number() and then sort by row_number > descending and pick off the first row as the total number. if i understand your question: count(*) over () (u can use aggregate functions as well, not only window functions) mvg, Wim