Re: SQL syntax

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Dale Seaburg <kg5lt(at)verizon(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: SQL syntax
Date: 2018-03-03 05:58:45
Message-ID: 0FDF9F9D-354A-40D4-A8FC-48EF7BA2D22C@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> On Mar 2, 2018, at 5:41 PM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> wrote:
>
>> On 03/02/2018 04:36 PM, Dale Seaburg wrote:
>> My mind is drawing a blank. Not sure where to go to find the answer. Here is the statement in C#:
>> sSQL = "SELECT \"Image_Filename\" FROM \"Instruments\" WHERE ";
>> To finish off the WHERE clause, I need to look at the first 2 letters, like "D:". My question is how do I specify in the WHERE clause, to look at the first 2 characters in the Image_Filename column? What is the correct SQL syntax for looking at just a portion of a column?
>
> SELECT "Image_Filename" FROM "Instruments" WHERE "ImageFilename" LIKE 'D:%';
>
> If you want case insensitive then ILIKE. For more info:
> https://www.postgresql.org/docs/10/static/functions-matching.html#FUNCTIONS-LIKE
>
>> I feel so dumb... This can't be that hard, but I am exhausted and running out of ideas. I need someone to give me a boost! ;-)
>> Thanks,
>> Dale.
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
Use the tilda, Luke.
filename ~ ‘^D:’

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roger Sunny 2018-03-03 07:08:56 pg_upgrade fails to restore function
Previous Message Tom Lane 2018-03-03 01:07:47 Re: SQL syntax