List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:May 2 2007 7:49pm
Subject:Re: View select results
View as plain text  
 >One last thing: you set, at first, a parameter called @prev with Null
 >(' ') value: right?

No, I set it to a string containing one space char. Use anything that 
does not occur as data in the column.

 >And, after, you use, instead IF ELSE statement, another syntax: is it
 >trinary operator? if yes, why it not is in the online MySQL manual?

I used the IF() function, see 'Control Flow Functions' under 'Functions 
and Operators' in the manual

PB

------

spacemarc wrote:
> 2007/5/2, Peter Brawley <peter.brawley@stripped>:
>> Right, give the computed column an alias differeing from the column 
>> name, eg
>>
>> SET @prev='';
>> SELECT
>>   IF(area = @prev, '', @prev := area) AS AreaHdr,
>>   text,amount
>> FROM products
>> ORDER BY area DESC;
>
> ok, now it works! thanks!
>
> One last thing: you set, at first, a parameter called @prev with Null
> (' ') value: right?
>
> And, after, you use, instead IF ELSE statement, another syntax: is it
> trinary operator? if yes, why it not is in the online MySQL manual?
>
Thread
View select resultsspacemarc2 May
  • Re: View select resultsBaron Schwartz2 May
  • Re: View select resultsPeter Brawley2 May
Re: View select resultsspacemarc2 May
Re: View select resultsPeter Brawley2 May
  • Re: View select resultsspacemarc2 May
    • Re: View select resultsPeter Brawley2 May