I am wanting to write a query that shows accounts related to a selected user
An example of my code so far can be seen below. I just need to know what goes where the
asked 22 Jul '16, 07:15
In order to use wildcards like '%' in a comparison, you have to use the LIKE operator (or SIMILAR/REGEXP for v11 and above), so the following should work:
In contrast, in your sample, "createdby = '%'" would only evaluate to true for the value '%' itself.
I'm assuming that createdby is declared as NOT NULL, otherwise you would need to handle NULL values, as well.
Note, a more efficient (and comprehensible IMHO) condition, also treating possible NULLs for createdby correctly, would be to use