# File test/src/sql.rb, line 218
  def to_s
    result = "select "
    if distinct
      result << 'distinct '
    end
    result << "#{select.join(', ')} from #{from.as_inner}"
    unless where.nil?
      result << " where #{where}"
    end
    unless groupby.nil?
      result << " group by #{groupby}"
    end
    unless orderby.nil?
      result << " order by #{orderby.join(', ')}"
    end
    result
  end