• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

comparing multiple values

Explorer ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

I am outputting a cfquery and I want to compare multiple columns within the same record to see which one is the largest. Any suggestion besides a huge complicated if else statement?
TOPICS
Advanced techniques

Views

338

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

Yes do it in the database before you get the query this is always preferable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

Well the problem with that is that I am building a cfquery on the fly from an xml document.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 20, 2007 Apr 20, 2007

Copy link to clipboard

Copied

LATEST
Try a simple if/else statement.

Once you have your query, add a column to it. Then loop through it and update this column based on that simple if/else statement. You might have a few else ifs depending on the number of columns you want to compare, but that just makes it long, not complicated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation