473,466 Members | 1,406 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

display results rotated (rows becomes columns)

When the number of columns get large, it becomes increasingly
difficult to view the results of a select in a small window (e.g. 80
line xterm) because of line wrapping. Can I have the results of the
select query displayed rotated, e.g. like this:

+------+------+------+------+
| | row0 | row1 | row2 |
+------+------+------+------+
| col0 | 0 | 3 | 6 |
| col1 | 1 | 4 | 7 |
| col2 | 2 | 5 | 8 |
+------+------+------+------+

$ uname -a
Linux mylinux 2.4.20-28.7 i686

mysql> select version();
+------------+
| version() |
+------------+
| 4.0.17-Max |
+------------+
1 row in set (0.00 sec)

mysql> create database foo;
Query OK, 1 row affected (0.00 sec)

mysql> use foo;
Database changed
mysql> create table t (
-> col0 integer,
-> col1 integer,
-> col2 integer
-> );
Query OK, 0 rows affected (0.00 sec)

mysql> insert into t values (0,1,2);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t values (3,4,5);
Query OK, 1 row affected (0.00 sec)

mysql> insert into t values (6,7,8);
Query OK, 1 row affected (0.01 sec)

mysql> select * from t;
+------+------+------+
| col0 | col1 | col2 |
+------+------+------+
| 0 | 1 | 2 |
| 3 | 4 | 5 |
| 6 | 7 | 8 |
+------+------+------+
3 rows in set (0.02 sec)

--

Jul 23 '05 #1
2 9891
Gnurp Gnarp wrote:
When the number of columns get large, it becomes increasingly
difficult to view the results of a select in a small window (e.g. 80
line xterm) because of line wrapping.


Have you tried using mysql --vertical, or ending your queries with "\G"?

Regards,
Bill K.
Jul 23 '05 #2
Bill Karwin wrote:
Have you tried using mysql --vertical, or ending your queries with
"\G"?


Excellent, exactly what I was looking for. Thanks Bill.

--

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

32
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is...
4
by: dmiller23462 | last post by:
Somebody take a look and give me any suggestions? My brain is nuked... Here's my deal....I have online submission forms on my intranet at work here....I am appending to an Access DB with the...
2
by: michael walser | last post by:
display checkbox in datagrid. I find that there are 3 status: checked - check box with click icon unchecked - blank in check box unknown - click icon but color in gray..... How can I set the...
18
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
2
by: Jae | last post by:
Does anyone know of a way to rotate text in a datagrid? I have tried this : http://msdn.microsoft.com/workshop/samples/author/dhtml/refs/writingMode.htm but this technique did not work for me. ...
4
by: Haydnw | last post by:
Hi, I'd like to put a load of database results (several rows for 5 fields) into a two-dimensional array. Now, this may be a really stupid question, but can someone give me a pointer for how to...
2
by: Sandy | last post by:
Hello - I have the following stored procedure and code. I want to put the results in two textboxes. I get to the part where I create the dataset and then I don't know what to do. I tried...
4
by: Plamen Ratchev | last post by:
What happens when you add the column WQR_TDH_HEADER_ID to both SELECT and GROUP BY? If you get rows you consider non-duplicate show as duplicate, then most likely your grouping does not include all...
3
by: Ken Fine | last post by:
This is a question that someone familiar with ASP.NET and ADO.NET DataSets and DataTables should be able to answer fairly easily. The basic question is how I can efficiently match data from one...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.