Note that there are some explanatory texts on larger screens.

plurals
  1. POSQL Select help - removing white space
    text
    copied!<p>I'm running into a problem when trying to select records from my 2005 MS-SQL database (I'm still very new to SQL, but I learned and use the basic commands from w3schools already). In theory, all my manufacturer records should be unique. At least that is how I intended it to be when I did my first massive data dump into it. Unfortunately, that is not the case and now I need to fix it! Here is my scenario:</p> <pre><code>Table name = ItemCatalog Relevant columns = Partnumber,Manufacturer,Category </code></pre> <p>When I did a <code>SELECT DISTINCT Manufacturer FROM ItemCatalog</code> this little problem is what turned up:</p> <p>Cables2Go<br> CablesToGo<br> Cables To Go<br> CableToGo Inc<br> CablesToGo Inc<br></p> <p>All 5 of those showed up as distinct, which they are. Can't fault my SELECT statement for returning it, but from my human perspective they are all the same manufacturer! One method I see working is doing an UPDATE command and fixing all the permutations that show up, but I have a LOT of manufacturers and this would be very time consuming. </p> <p>Is there a way when I punch in a SELECT statement, that I can find all the likely permutations of a manufacturer name (or any field really)? I attempted the LIKE operator, so my statement would read</p> <pre><code>SELECT Manufacturer FROM ItemCatalog WHERE Manufacturer LIKE '%CablesToGo%' </code></pre> <p>but that didn't turn out as well as I had hoped. Here's the nasty bit, my other program that I'm putting together absolutely requires that I only ask for a single manufacturer name, not all 5 variations. Maybe I'm talking in circles here, but is there is a simple way in one statement for me to find a similar string?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload