[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

select column where value of another column is contained

Posted on 2010-04-01
2
Medium Priority
?
157 Views
Last Modified: 2012-05-09
select o.orderid,o.shipaddress1,o.shipaddress2,n.note from orders o left join notes n on o.orderid=n.orderid where n.note like %o.shipaddress1% order by orderid desc

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'o'.


i want to select rows where n.note contains the value of o.shipaddress1
not equal but contains
0
Comment
Question by:rgb192
2 Comments
 
LVL 57

Accepted Solution

by:
Raja Jegan R earned 2000 total points
ID: 29371120
Fixed syntax mistake:

select o.orderid,o.shipaddress1,o.shipaddress2,n.note
from orders o left join notes n on o.orderid=n.orderid
where n.note like '%' + o.shipaddress1 + '%' order by orderid desc
0
 
LVL 1

Author Closing Comment

by:rgb192
ID: 31710049
thanks
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question