Further to my message of 3rd inst. Following your suggestion and after reading some documents, I created
this sql script:
-----
SELECT scheda_ltr, case scheda_ltr
when 'T' then
select * from bib_lt;
else
'autore, titolo, editore from bib_lt;'
end
FROM bib_lt;
-----
but the result is not what I was after: I get a list with either label
according to scheda_ltr being 'T' or not!
Is there any way, once the case is spotted, to obtain execution of the
query relating to that case, instead of just showing the label?
Of course I tried without the quotes obtaining parser error.
Ah - looks like I misunderstood what you were trying to do. There is no way to have a single query return rows with different numbers of columns - each row must be the same.
You'd have to do something like one of the following (substitute my_memo_column with whatever your memo field was called).
SELECT
scheda_ltr,
autore,
titolo,
editore,
CASE
WHEN scheda_ltr = 'T' THEN my_memo_column
ELSE 'n/a'
END AS my_memo_column
FROM
bib_lt;or...
SELECT
scheda_ltr,
CASE
WHEN scheda_ltr='T' THEN autore || ' / ' || titolo || ' / ' || editore
ELSE my_memo_column
END AS merged_columns
FROM
bib_lt;
HTH -- Richard Huxton Archonet Ltd
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster
