[prev in list] [next in list] [prev in thread] [next in thread]
List: mysql
Subject: RE: returning empty columns
From: "Price, Randall" <randallp () vt ! edu>
Date: 2006-02-28 14:54:40
Message-ID: 4C058118EC56B34E809904A5D0DA30872A6FC0 () elessar ! cc ! w2k ! vt ! edu
[Download RAW message or body]
Chris,
See if this works for you:
SELECT
' ' as 'Call'
, concat(FName, ' ', LName) as Name
, ' ' as 'Mar-6'
, ' ' as 'Mar-13'
, ' ' as 'Mar-20'
, ' ' as 'Mar-27'
FROM
table
ORDER BY
LName, FName
Notice that there is a single blank space being returned for the Call,
Mar-6, Mar-13, Mar-20, Mar-27 columns. I tried returning null as well
as an empty string (i.e., '') but those did NOT give me column headings.
Hope this helps.
Randall Price
VT.SETI.IAD.MIG:Microsoft Implementation Group
http://vtmig.vt.edu
Randall.Price@vt.edu
-----Original Message-----
From: 2wsxdr5 [mailto:2wsxdr5@cox.net]
Sent: Tuesday, February 28, 2006 3:43 AM
To: mysql@lists.mysql.com
Subject: returning empty columns
This is probably going to sound like an odd request, but is there a way
to return empty columns in Mysql. For example a roll call sheet I want
to do a select of names from my table and then add a column for each of
the next 12 weeks. I tried this.....
SELECT `Call`, concat(FName, ' ', LName) as Name, 'Mar-6' ,'Mar-13',
'Mar-20', 'Mar-27'
FROM table
Order BY LName, FName
The problem is it put that date on every row and I just want the names
to show up in the column header I know I could just write some php code
to print out a table with the columns but I have a handy php function
the prints the out put of a query in a table already so if I can find
the right query I don't have to change that code any.
--
Chris W
KE5GIX
Gift Giving Made Easy
Get the gifts you want &
give the gifts they want
One stop wish list for any gift,
from anywhere, for any occasion!
http://thewishzone.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=Randall.Price@vt.edu
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=mysql@progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic