Discussions
Categories
- 197K All Categories
- 2.5K Data
- 546 Big Data Appliance
- 1.9K Data Science
- 450.8K Databases
- 221.9K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 552 MySQL Community Space
- 479 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.1K ORDS, SODA & JSON in the Database
- 556 SQLcl
- 4K SQL Developer Data Modeler
- 187.2K SQL & PL/SQL
- 21.4K SQL Developer
- 296.3K Development
- 17 Developer Projects
- 139 Programming Languages
- 293K Development Tools
- 110 DevOps
- 3.1K QA/Testing
- 646.1K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 158 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.2K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 19 Java Essentials
- 162 Java 8 Questions
- 86K Java Programming
- 81 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 205 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 468 LiveLabs
- 39 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 175 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 233 Portuguese
SQL help me (Pivot ?)

Hi !, I need help with PIVOT (I think the solution is with pivot, but I'm not sure)
Y Have the next table
Name Date Value
AAA 1-1-2020 10
AAA 2-1-2020 20
BBB 1-1-2020 40
CCC 1-1-2020 80
CCC 3-1-2020 30
CCC 4-1-2020 50
And I need get this:
1-1-2020 2-1-2020 3-1-2020 4-1-2020
AAA 10 20
BBB 40
CCC 80 30 40
If anyone can help me, I would be very grateful
Answers
-
-
Pivot is solution assuming you know all dates upfront or at least max possible number of distinct dates.
SY.
-
Hi,
Column names have to be known at compile time, before any data is retrieved. That means the column names can't depend on data in the table, so if you really want column names like "1-1-2020", you need Dynamic SQL.
For a work-around (including the case Solomon mentioned i reply #2, where you don't know how many distinct dates there are) seePIVOT SQL
-
Read the link on --> and answer questions #5 through #9
And CHANGE the subject of your thread based on request #2 from the link above (I posted below). This is not a paid-service.
2) Thread Subject lineGive your thread a meaningful subject, not just "help please", "Query help" or "SQL". This is the SQL and PL/SQL forum. We know your question is going to be about those things, make it meaningful to the type of question so that people with the right sort of knowledge can pick it up and those without can ignore it. Never, EVER, mark your subject as "URGENT" or "ASAP". This forum is manned by volunteers giving their own time to help and your question is never urgent or more important than their own work or than other people's questions. It may be urgent to you, but that's not forum members issue. By marking your question as urgent you are actually less likely to get a good response, as members will choose to ignore such questions or respond unfavorably.
-
Tnks to all.
That's my case Frank, I don't know the columns names neither how much are,
I I'll see the post !
Tnks !