[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Order by



The "order by" clause is part of the SQL statement that SQR sends to your
database manager.  It cannot use SQR variables - only database columns.  If
you're using Oracle you may be able to sort by (CASE SAL > 30000 THEN 'SA'
ELSE 'SE' END).

By the way, I think you want to use a numeric variable for salary (#sal, not
$sal), although you could do you "if" statement comparison with the column
variable itself (&sal).  Also, are you using comma as a decimal point (I
don't know whether SQR allows that in the program itself), or do you mean to
test salary against thirty thousand (in which case you should omit the
comma)?

-----Original Message-----
From: radhika reddy [mailto:radhika_05@hotmail.com]
Sent: Friday, August 27, 2004 12:49 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] Order by


Hi,

     I am having a problem using order by for a string variable ($type) in 
the following program(sample).

begin-procedure sample
begin-select
empname &ename
addr1 &addr1
addr2
sal  &sal
      let $sal=&sal
      if $sal>30,000
         let $type = 'SA'
     else
        let $type = 'SE'
     end-if
from table1

order by $type,empname,addr1    ! when i am giving $type in order by, it's 
not giving error but it's not giving desired output also

end-select
end-procedure

Any suggestions?

Thanks

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users