+ :test #'tables-equal)))
+ (order-by-slots (mapcar #'(lambda (ob) (if (atom ob) ob (car ob)))
+ (listify order-by))))
+
+
+ (when (and order-by-slots (= 1 (length tables)))
+ ;; Add explicity table name if not specified and only one selected table
+ (let ((table-name (sql-output (car tables) database)))
+ (loop for i from 0 below (length order-by-slots)
+ do (when (typep (nth i order-by-slots) 'sql-ident-attribute)
+ (unless (slot-value (nth i order-by-slots) 'qualifier)
+ (setf (slot-value (nth i order-by-slots) 'qualifier) table-name))))))
+
+ (dolist (ob order-by-slots)