MySQL Wildcards

My question is sort of two-fold. The first being which version of my sql is Toad DP 3.5 on?

I’m not much of a mysql coder but I am using my local storage connection for a project. What is the proper syntax for using a ‘like’ clause on another field name, versus actual text. For example, let’s say the two fields are phone numbers (a.phone) and (b.phone).

How should the syntax look for a “where a.phone like b.phone”

You will need to code similiar to:

where a.phone like b.phone + ‘%’ (for SQL server) or like b.phone || ‘%’ (for Oracle).

Basically you need to compare one value with like to the other value variable with the wild card concatonated. You may need to use the concatonate function (instead of + or ||) , I don’t know mySQL.

To Tony Byrnes:

Thank you for posting in Toad World!

Extending on GregDavis11009’s answer, one may be able to compile basic queries through the Query Editor. Here’s a workflow!

Using Query Builder in Local Storage

  1. Open the Local Storage Connection

  2. Click on the “Query Builder” button (usually on the toolbar)

6378.1.png

  1. Drag and drop your desired content from the Object Explorer

0027.2.png

  1. When it comes to specifying the WHERE clause, push the “Global Where” button (the globe with a W)

3a.png

  1. Use combinations of Operators, columns, and functions to construct the WHERE statement!

1581.3.png

  1. Right-click the Object Explorer and select “Open in Editor” to apply even more tweaks manually.

2260.4.png

I believe your syntax may look similar to:
WHERE a.PHONE LIKE CONCAT(’%’, b.PHONE, ‘%’)

Let us know if this worked for you!

Software Associate Developer I,
-Joshua Liong