pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how to have 2 select creteria on one column?
4+ messages / 3 participants
[nested] [flat]

* how to have 2 select creteria on one column?
@ 2005-09-10 15:45 Michael Hoeller <MichaelHoeller@t-online.de>
  2005-09-10 16:31 ` Re: how to have 2 select creteria on one column? Richard Huxton <dev@archonet.com>
  2005-09-10 17:57 ` Re: how to have 2 select creteria on one column? Bruno Wolff III <bruno@wolff.to>
  0 siblings, 2 replies; 4+ messages in thread

From: Michael Hoeller @ 2005-09-10 15:45 UTC (permalink / raw)
  To: pgsql-sql

Hello, 

I would like to select every row which has got in the column CODE a "k" 
but I want to exclude every "kV" -- may be it is due to the fact that 
it is Saturday and I work too long I don't get it.. I tried a 
subselect, union but I struggle with the two select creteria on one 
column.

Can some one help me -- hope this is not a too stupid question. Normally 
google is my friend but also there I did not find a solution.

Thanks a lot 
Michael



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: how to have 2 select creteria on one column?
  2005-09-10 15:45 how to have 2 select creteria on one column? Michael Hoeller <MichaelHoeller@t-online.de>
@ 2005-09-10 16:31 ` Richard Huxton <dev@archonet.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Richard Huxton @ 2005-09-10 16:31 UTC (permalink / raw)
  To: Michael Hoeller <MichaelHoeller@t-online.de>; +Cc: pgsql-sql

Michael Hoeller wrote:
> Hello, 
> 
> I would like to select every row which has got in the column CODE a "k" 
> but I want to exclude every "kV" -- may be it is due to the fact that 
> it is Saturday and I work too long I don't get it.. I tried a 
> subselect, union but I struggle with the two select creteria on one 
> column.

SELECT * FROM my_table
WHERE code = 'k'
AND code <> 'kV'
;

HTH
-- 
   Richard Huxton
   Archonet Ltd



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: how to have 2 select creteria on one column?
  2005-09-10 15:45 how to have 2 select creteria on one column? Michael Hoeller <MichaelHoeller@t-online.de>
@ 2005-09-10 17:57 ` Bruno Wolff III <bruno@wolff.to>
  1 sibling, 0 replies; 4+ messages in thread

From: Bruno Wolff III @ 2005-09-10 17:57 UTC (permalink / raw)
  To: Michael Hoeller <MichaelHoeller@t-online.de>; +Cc: pgsql-sql

On Sat, Sep 10, 2005 at 17:45:50 +0200,
  Michael Hoeller <MichaelHoeller@t-online.de> wrote:
> Hello, 
> 
> I would like to select every row which has got in the column CODE a "k" 
> but I want to exclude every "kV" -- may be it is due to the fact that 
> it is Saturday and I work too long I don't get it.. I tried a 
> subselect, union but I struggle with the two select creteria on one 
> column.

Your description isn't as precise as would be nice. But from what I can figure
you want:
code ~ '^k[^V]'



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Fwd: how to have 2 select creteria on one column? SOLVED
@ 2005-09-10 16:41 Michael Hoeller <MichaelHoeller@t-online.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Michael Hoeller @ 2005-09-10 16:41 UTC (permalink / raw)
  To: pgsql-sql

Hello,

sometime you have to write a mail and your brain gets cleared...

select a.code 
from stamm a 
where 
a.skart in ( 
	(select skart 
	from stamm 
	where code like '%k%') 
	) 
and a.code not like '%V%';

May be this is not nice but this brings back the list I have.  

Michael
Hello, 

I would like to select every row which has got in the column CODE a "k" 
but I want to exclude every "kV" -- may be it is due to the fact that 
it is Saturday and I work too long I don't get it.. I tried a 
subselect, union but I struggle with the two select creteria on one 
column.

Can some one help me -- hope this is not a too stupid question. Normally 
google is my friend but also there I did not find a solution.

Thanks a lot 
Michael

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-09-10 17:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-09-10 15:45 how to have 2 select creteria on one column? Michael Hoeller <MichaelHoeller@t-online.de>
2005-09-10 16:31 ` Richard Huxton <dev@archonet.com>
2005-09-10 17:57 ` Bruno Wolff III <bruno@wolff.to>
2005-09-10 16:41 Fwd: how to have 2 select creteria on one column? SOLVED Michael Hoeller <MichaelHoeller@t-online.de>

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