pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSQL question regarding a couple of table joins.
2+ messages / 2 participants
[nested] [flat]
* SQL question regarding a couple of table joins.
@ 2000-11-07 00:49 Warren Vanichuk <pyber@street-light.com>
0 siblings, 1 reply; 2+ messages in thread
From: Warren Vanichuk @ 2000-11-07 00:49 UTC (permalink / raw)
To: pgsql-sql
Greetings.
We three have three tables, a links table which stores basic information
about a link, a linksdetail table which stores more detailed information
about the link, and a linkdaystats table which records the daily statistical
information on the link.
My problem is, once a day I want to delete everything in that table to start
afresh. Any information accumulated in the linkdaystats table has been
parsed, multilated, spindled, whatever, and done with, do I merely do a
'drop from linkdaystats' to start afresh. The only issue is this causes
other queries to break, suck as the only below :
SELECT
links.linkid,
links.linkurl,
links.linktext,
links.bannerid,
linkdaystats.linkid
FROM
links,
linkdetail ,
linkdaystats
WHERE
links.linkid = linkdetail.linkid
----
linkid | linkurl | linktext | bannerid | linkid
--------+---------+----------+----------+--------
(0 rows)
----
Help? :) This is PostGreSQL 7.0.2 on Debian 2.2/Linux-2.2.17 (Kernel/PGSQL
from source)
--- Table information :
freehost=# \d links
Table "links"
Attribute | Type | Modifier
-----------+--------------+----------------------------------------------------
linkid | integer | not null default nextval('links_linkid_seq'::text)
linkurl | varchar(255) |
linktext | varchar(255) |
bannerid | integer |
Index: links_linkid_key
freehost=# \d linkdetail
Table "linkdetail"
Attribute | Type | Modifier
-------------------+--------------+----------
linkid | integer |
referrer | varchar(255) |
maxclicks | integer |
maximpressions | integer |
primarycategory | integer |
secondarycategory | integer |
tertiarycategory | integer |
weight | float4 |
starttime | timestamp |
stoptime | timestamp |
freehost=# \d linkdaystats
Table "linkdaystats"
Attribute | Type | Modifier
-------------+-----------+----------
linkid | integer |
datestamp | timestamp |
clicks | bigint |
impressions | bigint |
Sincerely, Warren
^ permalink raw reply [nested|flat] 2+ messages in thread
* RE: SQL question regarding a couple of table joins.
@ 2000-11-07 01:14 Edmar Wiggers <edmar@brasmap.com>
parent: Warren Vanichuk <pyber@street-light.com>
0 siblings, 0 replies; 2+ messages in thread
From: Edmar Wiggers @ 2000-11-07 01:14 UTC (permalink / raw)
To: Warren Vanichuk <pyber@street-light.com>; pgsql-sql
> SELECT
>
> links.linkid,
>
> links.linkurl,
> links.linktext,
> links.bannerid,
> linkdaystats.linkid
> FROM
> links,
> linkdetail ,
> linkdaystats
> WHERE
> links.linkid = linkdetail.linkid
I guess you have forgot to include: "links.linkid = linkdaystats.linkid"
Moreover, if table linkdaystats is empty that query will return NOTHING. The
solution is to remove linkdaystats from the query, or wait for 7.1 and use
OUTER JOINs.
Yours sincerely,
Edmar Wiggers
BRASMAP Information Systems
+55 48 9960 2752
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-11-07 01:14 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-11-07 00:49 SQL question regarding a couple of table joins. Warren Vanichuk <pyber@street-light.com>
2000-11-07 01:14 ` Edmar Wiggers <edmar@brasmap.com>
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