Search Postgresql Archives

Building a "complex" select?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need a select like this..:

select ordre.id, ordre.desc, log_stop.stoptype from ordre left outer join log_stop on
ordre.id = log_stop.ordreid where ordre.id = 22

The problem is that I need to include "where log_stop.stoptype = 1". So if log_stop
includes 3 rows with stoptype = 1 and ordreid = 22, my select should return 3 rows.
Also, if log_stop includes 3 rows with stoptype = 1 and 2 rows with stoptype = 2, my
select should still return 3 rows. And if there are 0 rows with stoptype = 1, my
select should return 1 row.

Is this possible?


Regards,

BTJ

-- 
-----------------------------------------------------------------------------------------------
Bjørn T Johansen

btj@xxxxxxxxxx
-----------------------------------------------------------------------------------------------
Someone wrote:
"I understand that if you play a Windows CD backwards you hear strange Satanic messages"
To which someone replied:
"It's even worse than that; play it forwards and it installs Windows"
-----------------------------------------------------------------------------------------------

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux