Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-11-2005, 12:07 PM   #1 (permalink)
econ
Junior Member
 
Join Date: Jun 2005
Posts: 28
Default compare two columns

I have a table that I need to compare two columns. Column A contains a string that should be part of Column B. For example, Column A is "Climber" and Column B is "High Point Climber". I need to find the rows where the string in Column A is not included as part of the string in Column B.

thanks
econ is offline   Reply With Quote
Sponsored Links
Old 12-13-2005, 01:59 PM   #2 (permalink)
pairbrother
Member
 
Join Date: Nov 2005
Posts: 43
Default

Code:
select * from tablename where instr(columnB, columnA)

I think you'll have to look for the syntax of instr()
pairbrother is offline   Reply With Quote
Old 12-13-2005, 06:08 PM   #3 (permalink)
sandman
Junior Member
 
Join Date: Jul 2005
Posts: 34
Default

Give this a try:

select A, B
from yourtable
where B not like '%' || A || '%'

If needed on your particular server you may have to substitute the database's string concatenation operator for the standard SQL "double pipes" (||) operator.
sandman is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 07:29 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums