By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 1,218 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

Simplyfying many equals in a join

P: n/a
Many thanks to all who pointed out the usefulness of the 'ANALYZE' command
in my last question. I assumed the db admin was doing 'VACUUM ANALYZE'
after each days insert but he wasn't.

Is there a shorthand notation when performing a multi-table join and one
column is to be equaled in all tables? i.e. the following gets tedious to

select tq1.timestamp as t, tq1.value as q1, tq2.value as q2,
tq3.value as q3, tq4.value as q4 from
cal_quat_1 tq1, cal_quat_2 tq2, cal_quat_3 tq3, cal_quat_4 tq4
where tq1.timestamp = tq2.timestamp
and tq1.timestamp = tq3.timestamp
and tq1.timestamp = tq4.timestamp
and tq2.timestamp = tq3.timestamp
and tq2.timestamp = tq4.timestamp
and tq3.timestamp = tq4.timestamp
and tq1.timestamp > '2004-01-12 09:47:56.0000 +0'::timestamp with timezone
and tq1.timestamp < '2004-01-12 09:50:44.7187 +0'::timestamp with timezone
order by tq1.timestamp;

Each timestamp is indexed so the above is actually quite quick.
Nevertheless, the syntax of equating each table's timestamp to the others
is rather verbose.

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

Nov 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.