Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to select part of a field....

Status
Not open for further replies.

mgould00

Programmer
Feb 18, 2003
22
0
0
US
i have a field that contains data like this:

LEVEL 2 CERAMIC TILE @ MASTER BATH
LEVEL 2 CERAMIC TILE @ OPT MASTER BATH
LEVEL 2 CERAMIC TILE @ MAIN BATH
LEVEL 2 CERAMIC TILE @ KITCHEN
LEVEL 2 CERAMIC TILE @ LAUNDRY
LEVEL 3 CERAMIC TILE @ MASTER BATH
LEVEL 3 CERAMIC TILE @ OPT MASTER BATH
LEVEL 3 CERAMIC TILE @ MAIN BATH
LEVEL 3 CERAMIC TILE @ KITCHEN
LEVEL 3 CERAMIC TILE @ LAUNDRY
etc...

i want to select all the text after the '@' only, and i want it 'disticntly'

any ideas? thanks in advance....

 
Try this:

SELECT DISTINCT SubString(
CharIndex('@', Column)
, Len(Column)
)
FROM YourTable



--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
You could try this.

select distinct substring(fieldname, 24,?)

How big is the field? For Example if you filed is char(80) you would put 80 where the ? is. This will give you the remainder of the field. Also this will only work if it is always 24 characters to after the @ sign.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top