[...] (', ', '%@aol.com', '%@msn.com')
{stop}[(u'Wendy Williams, wendy@aol.com',)]
+.. _sqlexpression_order_by_label:
+
Ordering or Grouping by a Label
-------------------------------
[...] ()
{stop}[(u'jack', 2), (u'wendy', 2)]
+See also :ref:`sqlexpression_order_by_label` for an important technique
+of ordering or grouping by a string column name.
+
HAVING can be used to filter results on an aggregate value, after GROUP BY has
been applied. It's available here via the :meth:`_expression.Select.having`
method:
SQL also has a "RIGHT OUTER JOIN". SQLAlchemy doesn't render this directly;
instead, reverse the order of the tables and use "LEFT OUTER JOIN".
+.. _tutorial_order_by:
+
ORDER BY
^^^^^^^^^
[('sandy', 2)]
{opensql}ROLLBACK{stop}
+.. _tutorial_order_by_label:
+
Ordering or Grouping by a Label
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All existing ORDER BY settings can be suppressed by passing
``None``.
+ .. seealso::
+
+ These sections describe ORDER BY in terms of :term:`2.0 style`
+ invocation but apply to :class:`_orm.Query` as well:
+
+ :ref:`tutorial_order_by` - in the :ref:`unified_tutorial`
+
+ :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`
+
"""
if len(clauses) == 1 and (clauses[0] is None or clauses[0] is False):
passing ``None`` - this will suppress any GROUP BY configured
on mappers as well.
- .. versionadded:: 1.1 GROUP BY can be cancelled by passing
- ``None``, in the same way as ORDER BY.
+ .. seealso::
+
+ These sections describe GROUP BY in terms of :term:`2.0 style`
+ invocation but apply to :class:`_orm.Query` as well:
+
+ :ref:`tutorial_group_by_w_aggregates` - in the
+ :ref:`unified_tutorial`
+
+ :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`
"""
.. seealso::
- :ref:`core_tutorial_ordering`
+ :ref:`tutorial_order_by` - in the :ref:`unified_tutorial`
+
+ :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`
"""
.. seealso::
- :ref:`core_tutorial_ordering`
+ :ref:`tutorial_group_by_w_aggregates` - in the
+ :ref:`unified_tutorial`
+
+ :ref:`tutorial_order_by_label` - in the :ref:`unified_tutorial`
"""