SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Guru johnjohn2's Avatar
    Join Date
    Apr 2004
    Location
    here
    Posts
    746
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    postgresql sql question on %

    I'm trying to get this code to work but it doesn't like the "%". If I remove it the query works but then my wildcarding disappears. Does postgresql use something different then % for wildcard characters? col17 is a varchar field so there shouldn't be any problems with spaces front or back. Not sure what else to check.

    SELECT tbl3.col22, tbl3.col11, tbl3.col17
    FROM tbl3 LEFT JOIN tbl4view ON tbl3.col1 = tbl4view.col13
    WHERE tbl3.col17 LIKE '%a99%'

  2. #2
    SitePoint Guru johnjohn2's Avatar
    Join Date
    Apr 2004
    Location
    here
    Posts
    746
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just tested it again. Actually the wildcards do work but not correctly. I thought % represented any number of characters? Something weird is going on here.

    ie.
    field value = 1234

    if I enter 1 it works it find the record.
    if I enter 2 it works it find the record.
    if I enter 3 it works it find the record.
    if I enter 4 it works it find the record.

    if I enter 12 it doesn't find the record.
    if I enter 123 it doesn't find the record.
    if I enter 23 it doesn't find the record.
    if I enter 234 it doesn't find the record.
    if I enter 1234 it doesn't find the record.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •