473,402 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

how to join based on substring in sql query

how to join based on substring in sql query?

example: i am joind 2 tables first table 175 056 venkatesh
second table 056 venkatesh NV how can i join....
Oct 22 '11 #1
2 4040
NeoPa
32,556 Expert Mod 16PB
Unless you can be more specific about the actual requirements I suspect this is not possible.

The Like comparison allows one whole string to be compared to another sub-string, but you'd need to know exactly what you were trying to compare first. Looking for any unspecified overlap is frankly non-sensical (as that could include something as simple as a space technically).

Please feel free to clarify the question such that it makes proper sense and we can try to help you.
Oct 22 '11 #2
nbiswas
149 100+
Try this

Expand|Select|Wrap|Line Numbers
  1. Declare @table1 table(T1Col1 int,T1Col2 int,T1Col3 varchar(50))
  2. Insert Into @table1 Select 175, 056,'venkatesh'
  3.  
  4. Declare @table2 table(T2Col1 int,T2Col2 varchar(50),T2Col3 varchar(50))
  5. Insert Into @table2 Select 056,'venkatesh','NV'
  6.  
  7. Select 
  8.         t1.*
  9.         ,t2.*
  10. From @table1 t1
  11. Join @table2 t2
  12. On t1.T1Col2 = t2.T2Col1
  13.  
Result
------

Expand|Select|Wrap|Line Numbers
  1. T1Col1    T1Col2    T1Col3    T2Col1    T2Col2    T2Col3
  2. 175    56    venkatesh    56    venkatesh    NV
Hope this helps
Oct 23 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: GrungyApe | last post by:
I am new to this type of query and while I've found a lot of help on the forums, I am simply not getting it to work. Here is my attempt currently: SELECT DISTINCT(VADR.SUBSCRIBER_ID),...
2
by: Flavio | last post by:
Hi, I'm used in MS Access on Doing Queries based on Queries. Now that I'm dealling a lot with large ammount of data I think this procedure with an SQL Server back-end is falling a little bit...
2
by: ja | last post by:
Hello, I am trying to combine/substring parts of three different fields into one. For example, in sql, the syntax is as follows: Once the extra field has been added to the table, update...
9
by: deko | last post by:
I need to create a Recordset of all records that appear in one table but do NOT appear in another. To get the records that appear in BOTH tables, I can do this: SELECT tblEntity.Entity_ID...
2
by: Michele Fondry via .NET 247 | last post by:
hello. I have a webform form app in vb.Net that uses a SQL query. I am trying to use the substring function, but get the following error: Description: An unhandled exception occurred during the...
2
by: Bob Stearns | last post by:
I only want to do second join if the first was unsuccessful and was wondering if something like the following would be valid: select t1.*, t2.*, t3.* from t1 left outer join table (select...
8
by: chudson007 | last post by:
I need help capturing information from a free text field. The 10 examples below contain examples of the information I am trying to capture. In each cell I am trying to capture the number between...
1
by: starke1120 | last post by:
Is there a way to open a form based on query type.. Example.. If a certain query result is 1 then open the form to this result.. If the query results are NULL or 0 results, then open open for...
2
by: Kamil | last post by:
Hi. Is it possible to add new record to my recordset which is based on a query? I want to use this recordset only for temp starage of data, and I don't want to update values from this recordset...
2
by: Ken Jones | last post by:
Table URL_3 consist of the following 2 columns of information being Record No and URL No URL 1 http:/publishing/45/100006_f.SAL_Local.html 2 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.