-
m.alam
- Posts: 17
- Joined: Fri Nov 23, 2007 9:30 am
Post
by m.alam »
Hi,
I want use SQL statement like in mysql
select *from table1 where name like '%name1%' order by IF (name='name',1,0) desc;
Please provide me a equivalent statement that will run in vortex(I mean the 'IF()' in vortex).
Thanks
-
John
- Site Admin
- Posts: 2622
- Joined: Mon Apr 24, 2000 3:18 pm
- Location: Cleveland, OH
-
Contact:
Post
by John »
No, there currently is not an equivalent to the IF in Texis SQL. Note also that your syntax for the LIKE is not correct for Texis SQL either.
One approach in this case would be
SELECT * FROM table1 WHERE name like 'name1'
ORDER BY name - 'name'
which will rank 'name' first, and then the remaining names mostly alphabetically. Alternatively:
... ORDER BY length(name - 'name')
will list 'name' first, and then the names that are shortest after removing 'name'.
John Turnbull
Thunderstone Software