Search Postgresql Archives

Re: SQL query question

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

 



you're right it's late, i better to get to bed myself, i forgot to throw in the parameter for the user_id in there, i'm sure you can figure that one out.

regards,

-----
Jonel Rienton
http://blogs.road14.com
Software Developer, *nix Advocate
On Feb 3, 2005, at 1:32 AM, Uwe C. Schroeder wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Maybe it's to late for me to think correctly (actually I'm sure of that). I'm
going to ask anyways.
I have a table like


id int4
user_id int4
photo varchar
image_type char(1)

where image_type is either G or X
What I want to do is have ONE query that gives me the count of images of each
type per user_id.
So if user 3 has 5 photos of type G and 3 photos of type X
I basically want to have a result 5,3
It got to be possible to get a query like that, but somehow it eludes me
tonight.


Any pointers are greatly appreciated.

	UC

- --
Open Source Solutions 4U, LLC	2570 Fleetwood Drive
Phone:  +1 650 872 2425		San Bruno, CA 94066
Cell:   +1 650 302 2405		United States
Fax:    +1 650 872 2417
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFCAdOMjqGXBvRToM4RApgvAJsEUsdl6hrVGqRwJ+NI7JrqQqQ5GgCgkTQN
pavTkx47QUb9nr7XO/r/v5k=
=B3DH
-----END PGP SIGNATURE-----


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)




---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

[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