Re: ORDER BY ?, ?, ? DESC
Posted in 1995
rnatesan@bactc.com (Ramki Natesan) wrote: > >Hi, > In one of my i4gl tools, user wants to sort and display the records > by any given column names from the form. What I need to do is, take > those column names and use them in "ORDER BY ?, ?, ?" or in > "PREPARE" statement. I couldn't get it done in i4gl. Is there any > way, to achive this?. [clipped] > > Thanks in Advance, Ramki. Hi Ramki, I would try it with the following code: PROMPT "enter col1" FOR c1 PROMPT "enter col2" FOR c2 PROMPT "enter col3" FOR c3 LET strng = "SELECT * FROM emp_tab ORDER BY ", c1 CLIPPED, ", ", c2 CLIPPED, ", ", c3 CLIPPED PREPARE stmt FROM strng DECLARE cur1 SCROLL CURSOR FOR stmt OPEN cur1 I think this would work. Hope this helps... Dirch +----------------------------------------------------------------------------+ | Dirch Scheer email: scheer@stadt-mh.de | | Amt 10-3 Tel. : +49 208 455 1006 | | Stadtverwaltung (snail-)Mail : Ruhrstr. 32 | | Muelheim an der Ruhr D-45468 Muelheim an der Ruhr | +----------------------------------------------------------------------------+