Off the top of my head, in SQL Server you  can do it like this : 

SELECT PartNumber, 
'FirstBitOfPartNumber' = LEFT( PartNumber, FIND( '.', PartNumber ) )

FROM blahblahblah

If you wanted to just get matching rows, you can use that as a join
condition, e.g.

SELECT PartNumber

FROM Table1 INNER JOIN Table2 ON Table2.PartNumber = LEFT(
Table1.PartNumber, FIND( '.', Table1.PartNumber ) )

WHERE blah blah blah

Hope that helps

Alistair 

Alistair Davidson 
Application Developer
www.smartgroups.com
Freeserve.com PLC


-----Original Message-----
From: Alex [mailto:[EMAIL PROTECTED]] 
Sent: 29 July 2002 21:27
To: CF-Talk
Subject: Re: OT: SQL question

Great. You did not provide your database or setup. I can only assume you
are working on a mainframe hitting DB2.

On Mon, 29 Jul 2002, Phillip B wrote:

> I need to do this and don't know where to start.
>
> Compare part of a part number in one table to another table. The part
numbers look like this.
>
> 12345.123
> 12345.234
> 12345.654
> 02nt911dc.123
> 02nt911dc.054
> 02thq5
> 02thq7
>
> The part before the dot is all I want to use to compare to the other
table which will only contain the first part. It would be something like
this.
>
> 12345.123 = 12345
> 12345.234 = 12345
> 12345.654 = 12345
> 02nt911dc.123 = 02nt911dc
> 02nt911dc.054 = 02nt911dc
> 02thq5 = 02thq5
> 02thq7 = 02thq7
>
> How would I do that using just sql statements?
>
> Maybe when I have the server import I could have it create an extra
column that can contain a trimmed version of the part number. A master
number of sorts. Just a thought.
>
>
> Thanks
>
> Phillip Broussard
> Tracker Marine Group
> 417-873-5957
>
>
> 

______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to