Errors after manual SQL query

Help
2008-04-24
2013-05-28
  • In SQL search, instead of the proposed query:

    SELECT author, title, year, publication, volume, pages FROM refs WHERE location RLIKE "myemail" ORDER BY year DESC, author

    I tried
    SELECT author, title, year, publication, volume, pages FROM refs WHERE location RLIKE "myemail"

    which is still valid as ORDER BY is optional

    But then in the list of results if I want to see details of one entry, the refined SQL query is wrongly constructed and I get an error:

    SELECT author, title, type, year, publication, abbrev_journal, volume, issue, pages, corporate_author, thesis, address, keywords, abstract, publisher, place, editor, language, summary_language, orig_title, series_editor, series_title, abbrev_series_title, series_volume, series_issue, edition, issn, isbn, medium, area, expedition, conference, notes, approved, location, call_number, serial, marked, copy, selected, user_keys, user_notes, user_file, user_groups, cite_key, related, orig_record, serial, file, url, doi, isbn, type FROM refs LEFT JOIN user_data ON serial = record_id AND user_id = 2 WHERE serial RLIKE "^(17)$" ORDER BY SELECT author, title, year, publication, volume, pages, orig_record, serial, file, url, doi, isbn, type FROM refs WHERE location RLIKE "myemail"

    Actually my point wasn't to delete the ORDER BY just to try but to write another WHERE clause without bothering of adding a ORDERED BY stuff.

    I guess the reuse of the original SQL query should be robust against a missing ORDER BY

     
    • Philippe,

      good point, thanks. I'll have to investigate this. I agree with you that refbase should accept a manual SQL query that has no ORDER BY clause -- in that case, refbase should provide its default ORDER BY clause. I'll see what I can do.

      Thanks again, Matthias

       
    • Knut Krüger
      Knut Krüger
      2008-04-25

      Hi Matthias,

      I think that it is no Refbase question.
      The sql query does also  not work in PhpMyAdmin

      Knut