List:General Discussion« Previous MessageNext Message »
From:Jay J Date:May 1 1999 7:51am
Subject:Re: select nothin
View as plain text  
The most common method I know of is:

SELECT * FROM mytable WHERE 1 = 0;

Although, DBI & DBD::mysql gives you:

my @colnames = $sth->{NAME};

-Jay J

----- Original Message -----
From: Michael Farr <farrm@stripped>
To: MySQL <mysql@stripped>
Cc: Kevin R Falcone <kevinfal@stripped>
Sent: Saturday, May 01, 1999 2:32 AM
Subject: Re: select nothin


> At 03:25 AM 5/1/99 -0400, you wrote:
> >Replying to Michael Farr
> >> How do I select nothing from a database and still have the field names
> >> returned
> >>
> >> select * from tableName where 0;
> >> returns nothing, not even the field names .. I think
> >
> >Do you perhaps mean the following? events is a table.
> >
> >mysql> show columns from events;
> >+----------+-------------+------+-----+---------+-------+
> >| Field    | Type        | Null | Key | Default | Extra |
> >+----------+-------------+------+-----+---------+-------+
> >| location | varchar(20) | YES  |     | NULL    |       |
> >| specific | varchar(50) | YES  |     | NULL    |       |
> >| time     | varchar(8)  | YES  |     | NULL    |       |
> >| pm       | int(1)      | YES  |     | NULL    |       |
> >| month    | int(2)      | YES  |     | NULL    |       |
> >| day      | int(2)      | YES  |     | NULL    |       |
> >| info     | text        | YES  |     | NULL    |       |
> >| email    | varchar(50) | YES  |     | NULL    |       |
> >+----------+-------------+------+-----+---------+-------+
> >
> >show tables;
> >will show you the tables in a database.
> >
> >-kevin
> >
> >--
> >Kevin Falcone
> >kevinfal@stripped
> >
> Nope.  The graphical interface that I provide needs to be consistant.  My
> interface is dependant on the field names that are returned by MySQL.  So
> when the user makes a query that doesn't get any hits, they dont get to
see
> the field names.
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail mysql-thread2729@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail mysql-unsubscribe@stripped instead.
>
>

Thread
select nothinMichael Farr1 May
  • Re: select nothinKevin R Falcone1 May
    • Re: select nothinMichael Farr1 May
      • Re: select nothinThimble Smith1 May
  • Re: select nothinJay J1 May
Re: select nothinMichael Farr1 May
  • Re: select nothinMichael Widenius2 May