Awesome q2a theme
Ask us anything
Toggle navigation
Email or Username
Password
Remember
Login
Register
|
I forgot my password
Questions
Unanswered
Tags
Users
Ask a Question
Transposing SQL tables
0
like
0
dislike
47
views
faced with the task to transpose a table (turn 90 degrees).
there are columns
A | B | C
1 | 2 | 3
4 | 5 | 6
bring
A 1 4
B 2 5
C 3 6
on the Internet write
"my very strong advice: don't try to do this with SQL"
and a couple of rather "strange" options
What would you recommend?
mysql
asked
Mar 20, 2019
by
3ybHa9_Fe9
|
47
views
answer
comment
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
7
Answers
0
like
0
dislike
It is not entirely clear what type of data, but in any case fashionable simple enough to solve by using Dynamic SQL.
answered
Mar 22, 2019
by
Chvanikoff
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
A | B | C
1 | 2 | 3
4 | 5 | 6
\r
bring
A 1 4
B 2 5
C 3 6
answered
Mar 22, 2019
by
3ybHa9_Fe9
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
A | B | C
1 | 2 | 3
4 | 5 | 6
turn 90 degrees to the left:
3 6
B 2 5
A 1 4
\r
right:
4 1 A
5 2 B
6 3 C
\r
Transposition — replacing columns with rows, and not turn!
answered
Mar 22, 2019
by
Chvanikoff
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
If the data are not over many and the task of single — procedure is very simple:
1. To consider everything.
2. Transpose.
3. To record everything.
answered
Mar 22, 2019
by
3ybHa9_Fe9
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
I wonder where such a task.
\r
By the way, the DBMS essentially are able, in some sense, table transpose. This is called "index".
answered
Mar 22, 2019
by
Chvanikoff
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
It is unlikely this will help, but in MS-SQL'e this is done with the help of the function PIVOT. Perhaps Google on "pivot in MySql" will help
answered
Mar 22, 2019
by
Chvanikoff
ask related question
comment
Please
log in
or
register
to add a comment.
0
like
0
dislike
when dumb muscle is to learn how to do
answered
Mar 22, 2019
by
3ybHa9_Fe9
ask related question
comment
Please
log in
or
register
to add a comment.
Related questions
0
like
0
dislike
2
answers
How to make sql query to 3,4 or more related tables?
asked
Jun 3, 2019
by
mrusklon
mysql
0
like
0
dislike
1
answer
How to fix the error with transcoding tables through sql query in a MySQL database?
asked
Jun 14, 2019
by
KlinDev
mysql
1C-Bitrix
0
like
0
dislike
2
answers
How to make a working SQL query to two tables?
asked
May 21, 2019
by
tesq
mysql
0
like
0
dislike
1
answer
Fetch from multiple SQL tables of the same structure with one entity
asked
Mar 23, 2019
by
WASD42
mysql
sql
highload
0
like
0
dislike
1
answer
How to create SQL query from two tables by condition?
asked
May 22, 2019
by
leshqow
sql
database
visual-basic
Most popular tags
javascript
php
css
html
jquery
wordpress
python
linux
web-development
mysql
android
windows
java
layout
c#
computer-networks
node.js
cpp
iron
yii
vue.js
1C-Bitrix
react
laravel
django
nginx
system-administration
search-engine-optimization
api
ubuntu
the-it-education.
ajax
sql
programming
hosting
cms
design
apache
google-chrome
bootstrap
Vkontakte
macos
google
network-administration
git
laptops
algorithms
regular-expressions
unity-game-engine
email
angular
database
network-equipment
software
wooсommerce
debian
.net
ios
information-security
video
law-in-it
browsers
books
parsing
wi-fi
game-development
career
htaccess
postgresql
telegram
mikrotik
mobile-development
ruby-on-rails
the-domain-name-system
modx
Yandex
c
json
opencart
Habr
freelance
vpn
asp.net
windows-server
symfony
bots
hard-drives
math
qt
DIY
audio
frontend
payment-system
bash
electronics
gulp.js
user-interface
docker
online-shopping
110,608
questions
257,187
answers
0
comments
40,796
users