Home Return length of string for comparison
Reply: 0

Return length of string for comparison

user1669
1#
user1669 Published in August 16, 2018, 6:17 am

Is it possible to compare two strings on the length of the second string for example.

SELECT ProductDescription, Products  
FROM ProductDescription
INNER JOIN Products 
ON ProductDescription LIKE LEFT(Products, LENGTH(Products)) + '%'

Where Products is the string we are comparing with and the length of the comparison I would like to be the same length as the string if that makes sense?

Say we have Hydrogen and Hydrogen Oxide Like matches both so I need to specify what I am comparing...

further more the Description fields may for instance state:

Hydrogen Oxide is water. Oxygen is air. Hydrogen II and Oxygen II can be combined to create water. Hydrogen is a gas. Oxygen II is undefined.

I have a list of states for example: Oxygen. Hydrogen. Oxygen II. Hydrogen II. Hydrogen Oxide.

I would like to append the Correct chemicals to the Descriptions they concern. for example:

Hydrogen Oxide is water. | Hydrogen Oxide. Oxygen is air. | Oxygen Hydrogen II and Oxygen II can be combined to create water. | Hydrogen II, Oxygen II Hydrogen is a gas. | Hydrogen Oxygen II is undefined. | Oxygen II.

The results I can get from the query vary but I am trying to avoid:

Hydrogen Oxide is water. | Hydrogen Oxide. Oxygen is air. | Oxygen. Hydrogen II and Oxygen II can be combined to create water. | Oxygen II. Hydrogen II and Oxygen II can be combined to create water. | Hydrogen. II Hydrogen is a gas. | Hydrogen Oxygen II is undefined. | Oxygen.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.315503 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO