pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Dale Seaburg <kg5lt@verizon.net>
To: pgsql-general@postgresql.org
Subject: Re: SQL syntax
Date: Fri, 2 Mar 2018 16:41:35 -0800
Message-ID: <8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com> (raw)
In-Reply-To: <ff87d197-7438-5eb5-065d-f7c52c69b741@verizon.net>
References: <ff87d197-7438-5eb5-065d-f7c52c69b741@verizon.net>

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.klaver@aklaver.com




view thread (5+ messages)  latest in thread

Message-ID: <8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com>
Permalink:  ../8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com/
Also on:    postgresql.org/message-id/8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, kg5lt@verizon.net
  Subject: Re: SQL syntax
  In-Reply-To: <8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com>
  References: <ff87d197-7438-5eb5-065d-f7c52c69b741@verizon.net> <8be3c025-ebf8-59f4-1ab8-22206947e078@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox