>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 y
2007/5/2, Peter Brawley <[EMAIL PROTECTED]>:
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, a
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;
PB
spacemarc wrote:
2007/5/2, Peter Brawley <[EMAIL PROTECTED]>:
Works for me. Please post a CREA
2007/5/2, Peter Brawley <[EMAIL PROTECTED]>:
Works for me. Please post a CREATE TABLE stmt & enough INSERTs to
demonstrate the problem.
This is the dump (MySQL: 5.0.38): the table is not final version, just
to test the query.
CREATE TABLE `products` (
`area` varchar(25) NOT NULL,
`text` varcha
>can I obtain a recordset like this?
>area1, value_one, thing_one
> //, value_two, thing_32
> //, value_three, thing_ dd
>area2, value_ten, thing_6w
> //, value_ff, thing_l
SET @prev='';
SELECT
IF(area = @prev, '', @prev := area) AS area,
... other columns ...
FROM &c ...
PB
spacema
Hi,
spacemarc wrote:
Hi
my table have three fields that, if selected, are shown like:
area1, value_one, thing_one
area1, value_two, thing_32
area1, value_three, thing_ dd
area2, value_ten, thing_6w
area2, value_ff, thing_l
can I obtain a recordset like this?
area1, value_one, thing_
Hi
my table have three fields that, if selected, are shown like:
area1, value_one, thing_one
area1, value_two, thing_32
area1, value_three, thing_ dd
area2, value_ten, thing_6w
area2, value_ff, thing_l
can I obtain a recordset like this?
area1, value_one, thing_one
//, value_two,