You can nest string functions. For example, to display the last name and the first initial of each author, with a comma after the last name and a period after the first name, enter:
select (au_lname + "," + " " + substring(au_fname, 1, 1) + ".") from authors where city = "Oakland"
-------------------------------------------- Green, M. Straight, D. Stringer, D. MacFeather, S. Karsen, L. (5 rows affected)
To display the pub_id and the first two characters of each title_id for books priced more than $20, enter:
select substring(pub_id + title_id, 1, 6) from titles where price > $20
-------------- 1389PC 0877PS 0877TC (3 rows affected)
Copyright © 2005. Sybase Inc. All rights reserved. |