postmodern-many-to-many
Postmodern Examples Table of Contents
[Special Characters][A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [W] [X] [Y] [Z]
sql-op :+, :*, :%, :&, :|, :||, :=, :/, :!=, :<, :<>, :>, :<=, :>=, :^, *, /, , <, >, and, any, as, avg, between, case, coalesce, commit, constraints, count, current-date, current-timestamp, datatypes, date-part,date-trunc,desc, distinct, distinct-on, except, :except-all exists, group-by, having, in, insert, :intersect, :intersect-all, is-null, join cross-join, join inner-join, join left-join, join outer-join, like, limit, not,now, null, on, or, order-by, raw, rollback, select, set, some, sum, transactions, truncate, union, union-all, unique, update, using, when, while
Many to Many Calls
Many database records are linked in a many to many relationship with other tables or records. Consider the following query:
(query "select countries.id, countries.name, events.name as event
from countries,events,countries_events
where country_id=countries.id
and events.id=event_id
and events.id=$1"
29)
This can be rephrased in s-sql as:
(query (:select 'countries.id 'countries.name
(:as 'events.name 'event)
:from 'countries 'events 'countries_events
:where (:and (:= 'country_id 'countries.id)
(:= 'events.id 'event_id)
(:= 'events.id '$1)))
29)