I hope I am explaining this correctly. I have 2 tables, with first table (table1) +————+——+——-+——-+ | Date | Item | Block | Total | +————+——+——-+——-+ |…
Tag: group-by
MS-Access SQL DISTINCT GROUP BY
I am currently trying to SELECT the DISTINCT FirstNames in a GROUP, using Microsoft Access 2010. The simplified relevant columns of my table looks like this: My actual table contains two columns to which I want to apply this process (separately), but I should be able to simply repeat the process for the other column. The column group number is
group some row in resilt table
I need get a group some row select from result table. I’ve written select but have error message ORA-00913. How to write a correct select ?I have a result table: and insert: and I need to get result table: I’m trying: but ora-00913 too many values How to write correct “select” ? Sorry, There is some new conditions. The table
Postgres GROUP BY, then sort
I have a database query like: SELECT Foo, Foo2, some_calc as Bar, some_other_calc as Bar2, From FooBar — some inner joins for the calcs GROUP BY FOO ORDER BY Bar DESC, Bar2 DESC; I want …
SQL Group By Sum and Nulls
I have a query that fetch the sum of quantity of a certain date with a GROUP BY, but the query is giving me NULL results and not aggregating some values. Here is the query: Select VPC.Armazem …
SQL Server – group by with row number – Gaps and Islands
I have a table with data like this I need to create a view on top of this table to have data formatted in the below format for the Flag, basically the duration for which the Flag was Y or N. (EndDateSID – 0 is currently active, so today’s date) Most customers only have a change in their Flag once,
Oracle SQL Groupby and SUM
I have the following query that groups every tender id and description and shows its total Sum: 3020 American Express 20 1000 Cash – primary currency 9903.25 3120 House Card …
How to GROUP BY and CONCATENATE fields in redshift
How to GROUP BY and CONCATENATE fields in Redshift e.g. If I have table How can I get result like this There are some solutions for PostgreSQL, but none of functions mentioned in those answers are available in Redshift rightnow. Answer Well, I am a little late but the announcement about this feature happened on 3rd Aug 2015. Redshift has
Count number of records in subgroup while keeping a number of records in a group
I have a table with the following structure (it’s a simplified version, just to show the idea): name | city —————— John | New York Thomas | Berlin Hans | Berlin Boris | …
Using field in CASE without group by
I have the following code and I am having trouble figuring out how to NOT include these into the group by. Some of the arguments are purely for the case and that is all. I can’t include them in the group by. I cam’t really group by anything else as I need to get the counts by TransactionTyp only but