Doctrine 1
  1. Doctrine 1
  2. DC-889

Using RANDOM() AS rand as last field WITHOUT a comma between them works, but not randomly

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Query
    • Labels:
      None
    • Environment:
      ubuntu 64 bit, using a task in symfony

      Description

      The difference between the two code samples below is that there is a comma after 'lo.postal'_code in the second example:

      This code DOES NOT RANDOMIZE But also DOES NOT PRODUCE A PARSER ERROR
      $q = Doctrine_Query::create()
      ->select("li.id,
      ap.name,
      act.title, act.title_short, act.family_friendly,
      o.unix_ts_begin, o.unix_ts_end,
      act.description,
      act.cost_min, act.tags, act.cost_min, act.cost_notes, act.organization,
      lo.thoroughfare, lo.address_extra, lo.locality, lo.administrative_area, lo.country_name_code, lo.postal_code
      RANDOM() AS rand")
      ->from(blah, blah)
      ->where(primary key equality statements for joining)
      ->orderBy('rand');

      This DOES
      $q = Doctrine_Query::create()
      ->select("li.id,
      ap.name,
      act.title, act.title_short, act.family_friendly,
      o.unix_ts_begin, o.unix_ts_end,
      act.description,
      act.cost_min, act.tags, act.cost_min, act.cost_notes, act.organization,
      lo.thoroughfare, lo.address_extra, lo.locality, lo.administrative_area, lo.country_name_code, lo.postal_code,
      RANDOM() AS rand")
      ->from(blah, blah)
      ->where(primary key equality statements for joining)
      ->orderBy('rand');

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Guilherme Blanco
            Reporter:
            Dennis Gearon
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: