MLUG: Re: [MLUG] query to calculate column in mysql
Re: [MLUG] query to calculate column in mysql
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Tue, 7 Oct 2003, Asim wrote:

[...]
> -------------------------------------------------
> col1 | col2	| col3 | col4 | col5 | col6 | col7 |
> --------------------------------------------------
> user1	phy	  chm
> user2	chm	  antr	  phy
> user3	phy	  chm	  antr	  bio     chm
[...]
> this is pettrain of my table. i want to calculate that
> how many column are fill user 1,user2 and so on.
> in this case the answer of query (if apply on row1) is
> 2, on row2 answer is 3, on row 3 answer 5 and so on.
> please help me to write a query to calculate.

Try something like

	SELECT (length(col2)!=0)+(length(col3)!=0)+(length(col4)!=0)+...

It's a hack, but seems to do the trick.

-- 
Adam Procter
EMAIL:PROTECTED
_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members