Skip to main content
PHP Blog

Back to all posts

How to Select Two Max Functions In Oracle?

Published on
4 min read
How to Select Two Max Functions In Oracle? image

Best Oracle Database Tools to Buy in November 2025

1 Witch Tools Magic Oracle card: Fortune Teller Oracle cards for beginners, Uncover the mysterious wisdom of witchcraft with the help of sacred tools or magical symbols, gain guidance and inspiration

Witch Tools Magic Oracle card: Fortune Teller Oracle cards for beginners, Uncover the mysterious wisdom of witchcraft with the help of sacred tools or magical symbols, gain guidance and inspiration

  • UNLOCK YOUR MAGIC: 54 BEAUTIFULLY ILLUSTRATED ORACLE CARDS AWAIT!

  • PERFECT FOR BEGINNERS: DIVE INTO WITCHCRAFT WITH GUIDED INTUITION!

  • IDEAL GIFT: ENCHANTING DESIGN MAKES IT PERFECT FOR ANY OCCASION!

BUY & SAVE
$16.99
Witch Tools Magic Oracle card: Fortune Teller Oracle cards for beginners, Uncover the mysterious wisdom of witchcraft with the help of sacred tools or magical symbols, gain guidance and inspiration
2 Sacred Symbols Oracle Deck: For Divination and Meditation

Sacred Symbols Oracle Deck: For Divination and Meditation

BUY & SAVE
$21.79 $25.99
Save 16%
Sacred Symbols Oracle Deck: For Divination and Meditation
3 Work Your Light Oracle Cards: A 44-Card Deck and Guidebook

Work Your Light Oracle Cards: A 44-Card Deck and Guidebook

  • UNLOCK YOUR INTUITION WITH A STUNNING 44-CARD ORACLE DECK.
  • FIVE UNIQUE SUITS GUIDING YOU TO YOUR TRUE SELF.
  • ILLUMINATE YOUR LIFE AND INSPIRE OTHERS WITH YOUR ENERGY!
BUY & SAVE
$16.14 $21.99
Save 27%
Work Your Light Oracle Cards: A 44-Card Deck and Guidebook
4 Prism Oracle: Tap into Your Intuition with the Magic of Color

Prism Oracle: Tap into Your Intuition with the Magic of Color

  • UNIQUE 45-CARD SET ENHANCES INTUITIVE DECISION-MAKING.
  • COMPACT SIZE PERFECT FOR ON-THE-GO INSPIRATION AND INSIGHTS.
  • EYE-CATCHING DESIGN THAT APPEALS TO COLLECTORS AND ENTHUSIASTS.
BUY & SAVE
$18.00 $21.95
Save 18%
Prism Oracle: Tap into Your Intuition with the Magic of Color
5 Battery Replacement Tool Compatible with Burris® Oracle X Scope – Easy DIY Battery Access and Replacement.

Battery Replacement Tool Compatible with Burris® Oracle X Scope – Easy DIY Battery Access and Replacement.

  • EFFORTLESSLY REPLACE BATTERIES IN YOUR BURRIS ORACLE X SCOPE.
  • CONVENIENTLY STORE A SPARE BATTERY FOR UNINTERRUPTED USE.
  • DURABLE DESIGN ENSURES LONG-LASTING USE AND RELIABILITY.
BUY & SAVE
$20.00
Battery Replacement Tool Compatible with Burris® Oracle X Scope – Easy DIY Battery Access and Replacement.
6 Wisdom of the Oracle Divination Cards: A 52-Card Oracle Deck for Love, Happiness, Spiritual Growth, and Living Your Pur pose

Wisdom of the Oracle Divination Cards: A 52-Card Oracle Deck for Love, Happiness, Spiritual Growth, and Living Your Pur pose

  • IGNITE INTUITION WITH STUNNING RED DESIGN FOR DEEP CONNECTIONS.

  • DURABLE PREMIUM CARDSTOCK ENSURES SMOOTH, LASTING SHUFFLING.

  • COMPREHENSIVE GUIDEBOOK UNLOCKS INSIGHTS FOR ALL EXPERIENCE LEVELS.

BUY & SAVE
$15.29 $23.99
Save 36%
Wisdom of the Oracle Divination Cards: A 52-Card Oracle Deck for Love, Happiness, Spiritual Growth, and Living Your Pur pose
7 The Green Witch's Oracle Deck: Embrace the Wisdom and Insight of Natural Magic (Green Witch Witchcraft Series)

The Green Witch's Oracle Deck: Embrace the Wisdom and Insight of Natural Magic (Green Witch Witchcraft Series)

BUY & SAVE
$18.59 $19.99
Save 7%
The Green Witch's Oracle Deck: Embrace the Wisdom and Insight of Natural Magic (Green Witch Witchcraft Series)
8 78 Lythra Tarot Card Set, Tarot Oracle Cards for Beginners, Spiritual Tools for Intuition, Emotional Insight and Inner Wisdom, Suitable for Beginners and Advanced Readers

78 Lythra Tarot Card Set, Tarot Oracle Cards for Beginners, Spiritual Tools for Intuition, Emotional Insight and Inner Wisdom, Suitable for Beginners and Advanced Readers

  • CONNECT WITH YOUR INTUITION FOR PERSONAL GROWTH AND SELF-DISCOVERY.
  • ELEGANT ARTWORK BLENDS NATURE AND SYMBOLISM FOR SERENE REFLECTION.
  • INTUITIVE DESIGN SUITS BEGINNERS AND PROS FOR MEANINGFUL EXPERIENCES.
BUY & SAVE
$14.99
78 Lythra Tarot Card Set, Tarot Oracle Cards for Beginners, Spiritual Tools for Intuition, Emotional Insight and Inner Wisdom, Suitable for Beginners and Advanced Readers
9 Energy Oracle Cards

Energy Oracle Cards

  • ENHANCES EFFICIENCY: STREAMLINED FEATURES SAVE TIME AND EFFORT!
  • USER-FRIENDLY DESIGN: INTUITIVE INTERFACE FOR EASY NAVIGATION.
  • EXCEPTIONAL QUALITY: DURABLE MATERIALS FOR LONG-LASTING PERFORMANCE.
BUY & SAVE
$14.90 $25.99
Save 43%
Energy Oracle Cards
10 DPEHAKMK Crystal Information Cards Deck, 50 Crystal Meaning Cards, Healing Crystal Affirmation Deck with Chakra and Zodiac Associations and Energy Divination, Meditation Tool

DPEHAKMK Crystal Information Cards Deck, 50 Crystal Meaning Cards, Healing Crystal Affirmation Deck with Chakra and Zodiac Associations and Energy Divination, Meditation Tool

  • UNLOCK HEALING WISDOM: 50 CARDS WITH CRYSTALS & AFFIRMATIONS GUIDE YOU.
  • INTUITIVE GROWTH: ALIGNS CHAKRA, ZODIAC, AND ELEMENTAL ENERGIES SEAMLESSLY.
  • IDEAL GIFT CHOICE: BEAUTIFULLY PACKAGED FOR SPIRITUAL AND MINDFUL FRIENDS.
BUY & SAVE
$9.99 $13.99
Save 29%
DPEHAKMK Crystal Information Cards Deck, 50 Crystal Meaning Cards, Healing Crystal Affirmation Deck with Chakra and Zodiac Associations and Energy Divination, Meditation Tool
+
ONE MORE?

To select the maximum value from two columns in Oracle, you can use the GREATEST function. The GREATEST function returns the maximum value among the specified expressions or columns.

Syntax:

SELECT GREATEST(column1, column2) AS max_value FROM table_name;

Example:

SELECT GREATEST(salary, bonus) AS max_pay FROM employees;

In the above example, the GREATEST function will compare the values of the salary and bonus columns for each row in the employees table and return the maximum value as max_pay.

Note that if any of the columns or expressions provided to the GREATEST function have a NULL value, the overall result will be NULL.

How to use a subquery with two max functions in Oracle?

To use a subquery with two MAX functions in Oracle, you can follow these steps:

  1. Start by writing the outer query that will use the subquery. This outer query will have the main query logic and will call the subquery.
  2. Inside the subquery, write the inner query that will calculate the maximum value for the first column. This can be done using the MAX() function and providing the column name as the argument.
  3. Use the result of the first subquery as the input for the second subquery. Write another subquery inside the outer query to calculate the maximum value for the second column.

Here's an example to demonstrate the usage:

SELECT col1, col2 FROM your_table WHERE (col1, col2) = ( SELECT MAX(col1), MAX(col2) FROM your_table );

In this example, "your_table" is the name of your table, and "col1" and "col2" are the column names for which you want to find the maximum values. The outer query retrieves the rows where the combination of col1 and col2 matches the maximum values obtained from the subquery.

You can adjust the table and column names according to your specific scenario.

What is the limit of using max function in Oracle?

In Oracle, there is no specific limit on using the MAX function. You can use the MAX function in various contexts, such as aggregating data in a SELECT statement or as a part of a larger query. However, the result returned by the MAX function depends on the data type of the input values. For example:

  • For numeric values, the MAX function will return the highest value.
  • For character or string values, the MAX function will return the value that comes last in alphabetical order.

It's worth noting that the MAX function may not perform efficiently if used on a large dataset, so it's essential to consider performance implications when using it extensively.

How to include other aggregate functions along with two max functions in Oracle?

To include other aggregate functions along with two max functions in Oracle, you can use the SELECT statement and the GROUP BY clause. Here is an example:

SELECT column1, MAX(column2), MAX(column3), COUNT(*) FROM table_name GROUP BY column1;

In this example, column1 is used as the grouping column, and MAX(column2) and MAX(column3) are the two max functions included. The COUNT(*) function is also included as another aggregate function.

Make sure to replace table_name with the actual name of your table, and column1, column2, and column3 with the actual column names you want to use.

What is the syntax for selecting two max functions with distinct values in Oracle?

The syntax for selecting two max functions with distinct values in Oracle can be achieved using subqueries. Here is an example:

SELECT MAX(col1) AS max_value1, MAX(col2) AS max_value2 FROM (SELECT DISTINCT col1, col2 FROM your_table) subquery_alias;

In this example, col1 and col2 are the columns from your table, and your_table is the name of your table. The subquery selects the distinct values of col1 and col2, and the outer query then calculates the maximum values for each column.