Hi,
On Mon, 9 Aug 2004 18:12:42 +, in php.general you wrote:
* Thus wrote Jonathan Haddad:
The only problem there is when you group the LEFT JOIN pictures that
have a count of 0 return a count of 1. Unfortunately there's no single
query that I figured out when I did this same project
On Tuesday 10 August 2004 17:28, Peter Brodersen wrote:
.. but this is rather an SQL-related question.
That's what I pointed out last week when this thread started! Glad someone's
paying attention :)
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems
The only problem there is when you group the LEFT JOIN pictures that
have a count of 0 return a count of 1. Unfortunately there's no single
query that I figured out when I did this same project that would give
accurate results.
John Holmes wrote:
Mattias Jönsson wrote:
SELECT pics.*,
* Thus wrote Jonathan Haddad:
The only problem there is when you group the LEFT JOIN pictures that
have a count of 0 return a count of 1. Unfortunately there's no single
query that I figured out when I did this same project that would give
accurate results.
SELECT
pics.*,
(Sorry about all the quoting but I thought it makes sense for clarity -
Mattias)
Curt Zirzow wrote:
* Thus wrote Lenar Lhmus:
Mattias Thorslund wrote:
Though, (regardless of SQL database platform) in a case like this, it
MAY be both more straightforward and efficient to use two separate
Mattias Thorslund wrote:
Though, (regardless of SQL database platform) in a case like this, it
MAY be both more straightforward and efficient to use two separate
queries for the pictures and comments, given the one-to-many cardinality
between them. The above statement causes redundant data
* Thus wrote Lenar Lhmus:
Mattias Thorslund wrote:
Though, (regardless of SQL database platform) in a case like this, it
MAY be both more straightforward and efficient to use two separate
queries for the pictures and comments, given the one-to-many cardinality
between them. The above
I have a problem with my mysql query
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id GROUP
BY pic_comments.pic_id;
pics table:
| id | submitter | time | date | category |
pic_comments table:
| pic_id |
On Saturday 07 August 2004 17:27, Mattias Jönsson wrote:
I have a problem with my mysql query
This is a PHP list.
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design Hosting * Internet Intranet Applications Development *
Mattias Jönsson wrote:
I have a problem with my mysql query
try postgres instead http://www.postgresql.org/
--
Raditha Dissanayake.
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean
Raditha Dissanayake wrote:
try postgres instead http://www.postgresql.org/
It's the most helpful comment I've seen for a long time.
You know, it won't work in Postgre too probably. If you like Postgre -
use it and don't force others to use it (for wrong reasons nevertheless).
Everyone should
Mattias Jönsson wrote:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id
GROUP BY pic_comments.pic_id;
[snip]
The problem is that i only get the the pictures that have comments, i
want even the pictures
Lenar Lõhmus wrote:
Anyway, instead of writing this:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM pics,
pic_comments WHERE pics.category = 1 AND pics.id = pic_comments.pic_id
GROUP BY pic_comments.pic_id;
Write this:
SELECT pics.*, pic_comments.*, count(*) AS num_comments FROM
Lenar Lõhmus wrote:
Raditha Dissanayake wrote:
try postgres instead http://www.postgresql.org/
It's the most helpful comment I've seen for a long time.
You are most welcome.
--
Raditha Dissanayake.
14 matches
Mail list logo