Results 1 to 11 of 11

Thread: [RESOLVED] Sorting by a calculated field

Threaded View

  1. #1
    Join Date
    May 2009

    resolved [RESOLVED] Sorting by a calculated field

    I am trying to sort by a calculated field. I have 2 tables: lss1 and lss2. Each are the same. I am trying to get a sort order for their total number of hours.

    This is what I have but no total shows and the sorting does not happen.

    PHP Code:
    $sql="SELECT SUM(lss1.hours + lss2.hours) AS totalhours FROM lss1, lss2 WHERE lss1.lawyer=\"$profname\" OR lss2.lawyer=\"$profname\" ORDER BY totalhours desc";
    $result mysql_query($sql) or die(("Error: ".mysql_error().$sql));
    while (
    $rows=mysql_fetch_array($result)) {
    Last edited by beylah; 06-12-2014 at 09:38 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center