The theta join is probably the least used SQL join type. Here's an example of a theta join in use. Lets say you have a table of daily sales, and want a report showing the sales to date for each day.
<geshi lang="sql"> create table test (d datetime, v int)
insert into test values ('20100101', 0) insert into test values ('20100102', 20) insert into test values ('20100103', 30)
select b.d, sum(a.v) from test a join test b on a.d <= b.d group by b.d </geshi>
The result looks like this: <geshi> 1/01/2010 12:00:00.000 AM 0 2/01/2010 12:00:00.000 AM 20 3/01/2010 12:00:00.000 AM 50 </geshi>