pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
select question
10+ messages / 10 participants
[nested] [flat]

* select question
@ 1998-07-28 15:48 STMIK Stikubank <stmiknet@idola.net.id>
  1998-07-28 15:56 ` Re: [SQL] select question Chris Johnson <cmj@inline-design.com>
  0 siblings, 1 reply; 10+ messages in thread

From: STMIK Stikubank @ 1998-07-28 15:48 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

I have a table (mhs)  which fills as below :

nim
--------
94.31.0001
94.31.0002
95.31.0003
95.51.0004

then how can I get rows which meet with '94.31.xxxx'  (where x = don't
care)? I've already try :

 select * from mhs where nim likes '94.31';


with no success.

TIA

edhi





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

* Re: [SQL] select question
  1998-07-28 15:48 select question STMIK Stikubank <stmiknet@idola.net.id>
@ 1998-07-28 15:56 ` Chris Johnson <cmj@inline-design.com>
  1998-07-28 16:25   ` Re: [SQL] select question Roderick A. Anderson <raanders@altoplanos.net>
  0 siblings, 1 reply; 10+ messages in thread

From: Chris Johnson @ 1998-07-28 15:56 UTC (permalink / raw)
  To: STMIK Stikubank <stmiknet@mail.idola.net.id_nospam>; +Cc: pgsql-sql



On Tue, 28 Jul 1998, STMIK Stikubank wrote:

> Hi all,
> 
> I have a table (mhs)  which fills as below :
> 
> nim
> --------
> 94.31.0001
> 94.31.0002
> 95.31.0003
> 95.51.0004
> 
> then how can I get rows which meet with '94.31.xxxx'  (where x = don't
> care)? I've already try :
> 
>  select * from mhs where nim likes '94.31';

select * from mhs where nim like '94.31.%';





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

* Re: [SQL] select question
  1998-07-28 15:48 select question STMIK Stikubank <stmiknet@idola.net.id>
  1998-07-28 15:56 ` Re: [SQL] select question Chris Johnson <cmj@inline-design.com>
@ 1998-07-28 16:25   ` Roderick A. Anderson <raanders@altoplanos.net>
  0 siblings, 0 replies; 10+ messages in thread

From: Roderick A. Anderson @ 1998-07-28 16:25 UTC (permalink / raw)
  To: Chris Johnson <cmj@inline-design.com>; +Cc: STMIK Stikubank <stmiknet@mail.idola.net.id_nospam>; pgsql-sql

On Tue, 28 Jul 1998, Chris Johnson wrote:

> > care)? I've already try :
> > 
> >  select * from mhs where nim likes '94.31';
> 
> select * from mhs where nim like '94.31.%';
> 
Or
  select *
    from mhs
   where nim like '94.31.____';

Rod
--
Roderick A. Anderson
raanders@altoplanos.net               Altoplanos Information Systems, Inc.
Voice: 208.765.6149                            212 S. 11th Street, Suite 5
FAX: 208.664.5299                                  Coeur d'Alene, ID 83814




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

* select question
@ 1998-07-30 08:11 Christian Guenther <guenther@laokoon.in-berlin.de>
  0 siblings, 0 replies; 10+ messages in thread

From: guenther@laokoon.in-berlin.de @ 1998-07-30 08:11 UTC (permalink / raw)
  To: pgsql-sql

Hi,

is there anybody who can say my why following select-statement make
no results:

select main.name, main.sortname, main.stadt, main.id, statistik.hits from 
main, statistik where main.id = statistik.mu_id order by statistik.hits
DESC, main.sortname

I do not get any error, but no result too. I have tuples in statistik and
main where the main.id = statistik.mu_id

Any hints?

Thanks

Christian

-- 
 Christian Guenther         http://laokoon.in-berlin.de/Kuenstler/ 
 Fax: +49 030 4464152       http://laokoon.in-berlin.de/Museum/
 Tel: +49 030 4442931       E-mail: guenther@laokoon.in-berlin.de



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

* Select question
@ 2001-05-23 13:23 Chris Ruprecht <chrup999@yahoo.com>
  2001-05-23 16:15 ` Re: Select question Stephan Szabo <sszabo@megazone23.bigpanda.com>
  2001-05-23 16:18 ` Re: Select question Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 10+ messages in thread

From: Chris Ruprecht @ 2001-05-23 13:23 UTC (permalink / raw)
  To: pgsql-sql

Hi all,

although not new to databases, I'm new to the wonderful world of PostGreSQl
and SQL in general.
Question:

I do this query
phone=# select * from phonelog where cdate > 2001-05-18 order by cdate limit
2 ;

And I get theis result

   cdate    | ctime | countrycode | success | carrier | duration |
phonenumber | areacode | pseq
------------+-------+-------------+---------+---------+----------+----------
---+----------+------
 2001-04-01 |     0 |         370 |       1 |       1 |        8 | "3703348"
| "33"     | 4005
 2001-04-01 |     0 |          98 |       1 |       1 |       15 | "9871162"
| "71"     | 3889


Although I specified that I want only dates > 5/18/2001, I get dates
4/1/2001. Clearly, I ask the system the wrong question. How do I ask this
question the correct way?

Best regards,
Chris


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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

* Re: Select question
  2001-05-23 13:23 Select question Chris Ruprecht <chrup999@yahoo.com>
@ 2001-05-23 16:15 ` Stephan Szabo <sszabo@megazone23.bigpanda.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Stephan Szabo @ 2001-05-23 16:15 UTC (permalink / raw)
  To: Chris Ruprecht <chrup999@yahoo.com>; +Cc: pgsql-sql


I'm not sure, but...
Does it work if you say cdate > '2001-05-18' ?  (Possibly ::date too)
I'd guess your date value you're trying to put there is getting treated
as an integer expression.

On Wed, 23 May 2001, Chris Ruprecht wrote:

> Hi all,
> 
> although not new to databases, I'm new to the wonderful world of PostGreSQl
> and SQL in general.
> Question:
> 
> I do this query
> phone=# select * from phonelog where cdate > 2001-05-18 order by cdate limit
> 2 ;
> 
> And I get theis result
> 
>    cdate    | ctime | countrycode | success | carrier | duration |
> phonenumber | areacode | pseq
> ------------+-------+-------------+---------+---------+----------+----------
> ---+----------+------
>  2001-04-01 |     0 |         370 |       1 |       1 |        8 | "3703348"
> | "33"     | 4005
>  2001-04-01 |     0 |          98 |       1 |       1 |       15 | "9871162"
> | "71"     | 3889
> 
> 
> Although I specified that I want only dates > 5/18/2001, I get dates
> 4/1/2001. Clearly, I ask the system the wrong question. How do I ask this
> question the correct way?




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

* Re: Select question
  2001-05-23 13:23 Select question Chris Ruprecht <chrup999@yahoo.com>
@ 2001-05-23 16:18 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 10+ messages in thread

From: Tom Lane @ 2001-05-23 16:18 UTC (permalink / raw)
  To: Chris Ruprecht <chrup999@yahoo.com>; +Cc: pgsql-sql

"Chris Ruprecht" <chrup999@yahoo.com> writes:
> phone=# select * from phonelog where cdate > 2001-05-18 order by cdate limit
> 2 ;

Try

select * from phonelog where cdate > '2001-05-18' order by cdate limit 2

I think it's interpreting your query as where cdate > 1978 (result of
integer subexpression) and then doing some weird integer-to-date
conversion.  In general, any constant of a non-numeric datatype needs
to be quoted in SQL queries.

			regards, tom lane



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

* select question
@ 2002-08-28 20:12 george young <gry@ll.mit.edu>
  2002-08-28 20:21 ` Re: select question Wei Weng <wweng@kencast.com>
  2002-08-28 21:25 ` Re: select question eric soroos <eric-psql@soroos.net>
  0 siblings, 2 replies; 10+ messages in thread

From: george young @ 2002-08-28 20:12 UTC (permalink / raw)
  To: pgsql-sql

[postgreql 7.2, linux]
I have a table T with columns run, wafer, and test:
   T(run text, wafer int, test text)
Given a run and a set of wafers, I need the set of tests that match
*all* the specified wafers:

run	wafer	test
a	1	foo
a	2	foo
a	3	foo
a	3	bar

E.g.
  Given run 'a' and wafers (1,3) I should get one row: foo, since only foo matches both 1 and 3.
  Given run 'a' and wafers (3) I should get two rows: foo,bar, since both foo and bar match 3.

Is there some neat way to do this in a single query?

Puzzled,
	George


-- 
 I cannot think why the whole bed of the ocean is
 not one solid mass of oysters, so prolific they seem. Ah,
 I am wandering! Strange how the brain controls the brain!
	-- Sherlock Holmes in "The Dying Detective"



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

* Re: select question
  2002-08-28 20:12 select question george young <gry@ll.mit.edu>
@ 2002-08-28 20:21 ` Wei Weng <wweng@kencast.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Wei Weng @ 2002-08-28 20:21 UTC (permalink / raw)
  To: gry@ll.mit.edu; +Cc: pgsql-sql

You can use this query

SELECT * FROM T
	WHERE run = 'a' AND wafer = 1 AND test = 'foo'
UNION
SELECT * FROM T
	WHERE run = 'a' AND wafer = 2 AND test = 'foo'
UNION
SELECT * FROM T
	WHERE run = 'a' AND wafer = 3 AND test = 'foo'
UNION
SELECT * FROM T
	WHERE run = 'a' AND wafer = 3 AND test = 'bar'



On Wed, 2002-08-28 at 16:12, george young wrote:
> [postgreql 7.2, linux]
> I have a table T with columns run, wafer, and test:
>    T(run text, wafer int, test text)
> Given a run and a set of wafers, I need the set of tests that match
> *all* the specified wafers:
> 
> run	wafer	test
> a	1	foo
> a	2	foo
> a	3	foo
> a	3	bar
> 
> E.g.
>   Given run 'a' and wafers (1,3) I should get one row: foo, since only foo matches both 1 and 3.
>   Given run 'a' and wafers (3) I should get two rows: foo,bar, since both foo and bar match 3.
> 
> Is there some neat way to do this in a single query?
> 
> Puzzled,
> 	George
> 
> 
> -- 
>  I cannot think why the whole bed of the ocean is
>  not one solid mass of oysters, so prolific they seem. Ah,
>  I am wandering! Strange how the brain controls the brain!
> 	-- Sherlock Holmes in "The Dying Detective"
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org
> 
-- 
Wei Weng
Network Software Engineer
KenCast Inc.





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

* Re: select question
  2002-08-28 20:12 select question george young <gry@ll.mit.edu>
@ 2002-08-28 21:25 ` eric soroos <eric-psql@soroos.net>
  1 sibling, 0 replies; 10+ messages in thread

From: eric soroos @ 2002-08-28 21:25 UTC (permalink / raw)
  To: pgsql-sql

On Wed, 28 Aug 2002 16:12:41 -0400 in message <20020828161241.50a8512d.gry@ll.mit.edu>, george young <gry@ll.mit.edu> wrote:
> [postgreql 7.2, linux]
> I have a table T with columns run, wafer, and test:
>    T(run text, wafer int, test text)
> Given a run and a set of wafers, I need the set of tests that match
> *all* the specified wafers:
> 
> run	wafer	test
> a	1	foo
> a	2	foo
> a	3	foo
> a	3	bar
> 
> E.g.
>   Given run 'a' and wafers (1,3) I should get one row: foo, since only foo matches both 1 and 3.
>   Given run 'a' and wafers (3) I should get two rows: foo,bar, since both foo and bar match 3.
> 
> Is there some neat way to do this in a single query?
> 

select test from T
  where run='a' 
    and wafers in ('1','3')
  group by test
     
eric






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


end of thread, other threads:[~2002-08-28 21:25 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1998-07-28 15:48 select question STMIK Stikubank <stmiknet@idola.net.id>
1998-07-28 15:56 ` Chris Johnson <cmj@inline-design.com>
1998-07-28 16:25   ` Roderick A. Anderson <raanders@altoplanos.net>
1998-07-30 08:11 select question Christian Guenther <guenther@laokoon.in-berlin.de>
2001-05-23 13:23 Select question Chris Ruprecht <chrup999@yahoo.com>
2001-05-23 16:15 ` Re: Select question Stephan Szabo <sszabo@megazone23.bigpanda.com>
2001-05-23 16:18 ` Re: Select question Tom Lane <tgl@sss.pgh.pa.us>
2002-08-28 20:12 select question george young <gry@ll.mit.edu>
2002-08-28 20:21 ` Wei Weng <wweng@kencast.com>
2002-08-28 21:25 ` eric soroos <eric-psql@soroos.net>

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