Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can I use LEFT and RIGHT in sql like in VB, in the ORDER method

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-31 : 21:31:31
Jrift writes "I'm writing a simple search engine where I wish to order cd's by artist, title, and price. The trouble is that the database contains varying amounts of information, and I only wish to sort by the left few characters of each cd's title...like this...

SELECT * FROM table1
ORDER BY artist, LEFT(title,4), price

I know that this won't actually work, but I hope it gives you the idea. I've considered creating another another field, and copying the left four characters from each title into it, then sorting by that field, but this seems a bit clumsy.
Thanks in advance,
Jrift."
   

- Advertisement -