473,395 Members | 1,554 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,395 software developers and data experts.

Compare 2 columns having similar data

1
DB2 database: I am trying to join table A with table B where A.col1 and B.col1 are not exactly the same. a.col1 has B.col1 present inside it. Example: A.col1 value- XXZZZZZZA B.col1 value- ZZZZZZ I tried the below query but not working. select A.col5,B.col4 from table A INNER JOIN table B on locate (B.col1,A.col1) =1 and B.col1=205 with ur. I cannot use a substring as the no of characters before "ZZZZZZZ" may vary/ Is there any alternate options in db2 ?
Feb 14 '12 #1
1 2140
Rabbit
12,516 Expert Mod 8TB
Locate returns the index of the first occurrence of the search string. It doesn't always return 1. So you should be looking for everything returning larger than 0. However, rather than doing all that, I would suggest just using the LIKE predicate with the appropriate wildcards.
Feb 14 '12 #2

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

Similar topics

2
by: Steve Jebson | last post by:
I have 2 Customer Tables from different sources that i would like to merge into one master table. They have similar data but different field names and field orders. Is it possible to extract the...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
7
by: What-a-Tool | last post by:
Have an Access table loaded into a DataTable that was created at run time, and am displaying these contents in a data grid. Me.dgGames.DataSource = Me.DsGameInfo.Tables("Games") I would like to...
0
by: Michael Seele | last post by:
hi, how can i show all the columns and its data types? i create the following sql-statement but it only gets me a reference of the data types, how can i replace the reference? /SELECT...
17
by: vish | last post by:
Hi all, I know this might look strange at first look, but i am looping thru a dataset created using to different tables from database.These two tables have some fields with the same names. ...
14
by: WT | last post by:
Hello, I have a usercontrol loaded in a page with a theme. This usercontrol contains columns template with hyperlinks, with skinID. The columns are not displayed, seems thta there is some...
5
by: Yas | last post by:
Hello, I have the following table with 4 columns.... firstname, lastname1, lastname2, EMAIL Table has user names and email, I would like to generate a 5th column called DisplayName. The email...
1
by: Crombam | last post by:
Hi to all, After searching the net for a couple of hours I just have to ask the question. How can I close a report with a subform (Pivot Chart) when this Pivot Chart is having no data? ...
1
by: Jollywg | last post by:
I have 1 file that I need to compare two columns and count how many account names (column1 ie jollywg) do not have a /home directory with that name (column 6 ie /home/jollywg). The file name is...
2
by: rneeraj | last post by:
I am preparing an Employee database and would like to add more than one education details column in a form for each employee. Eg: A person must be holding a masters degree. I would like to add...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.