List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:May 22 2000 12:41am
Subject:Re: select only not null columns.
View as plain text  
At 2:17 PM -0700 2000-05-21, mysqluser php wrote:
>Dear Paul DuBois
>
>Thanks for reply. But I think my problem is some what
>different, let me explain it more.
>My table has one row , 8 columns. out of this 8
>columns i want to read (select) only  columns those
>have value. i.e. not null. How to do this?
>
>Regards
>Pradeep


If this means you want to select a variable number of columns,
depending on which ones are or are not NULL, I'm not sure how
to do this.  A SELECT statement always selects the same number
of columns per row.  Perhaps you can get tricky and use the
IFNULL() function, one test per column, and combine each test
with CONCAT() or something.


>
>
>--- Paul DuBois <paul@stripped> wrote:
>>  At 2:36 AM -0700 2000-05-21, mysqluser php wrote:
>>  >Hi!
>>  >
>>  >I have Mysql 3.22.30. Is there any way to select
>>  only
>>  >those columns which are not null? If Yes how? If no
>>  >then any other way?
>>  >If upgradition is solution, then will it effect my
>>  >present installed PHP3( installed from RPM compiled
>>  >for mysql) with Mysql & Apache sever.
>>
>>
>>  WHERE col_name IS NOT NULL
>>
>>
>>  If you're trying to use WHERE col_name != NULL, that
>>  won't work.
>>  To test against NULL, you need to use IS NULL or IS
>>  NOT NULL.
>>
>>  --
>>  Paul DuBois, paul@stripped
>
>
>__________________________________________________
>Do You Yahoo!?
>Send instant messages & get email alerts with Yahoo! Messenger.
>http://im.yahoo.com/


-- 
Paul DuBois, paul@stripped
Thread
select only not null columns.mysqluser php21 May
  • Re: select only not null columns.Paul DuBois21 May
Re: select only not null columns.mysqluser php22 May
  • Re: select only not null columns.Paul DuBois22 May