Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6477187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:55:03+00:00 2026-05-25T06:55:03+00:00

I have the following two mysql_queries : 1. $primary_img_query = SELECT imgWidth, imgHeight FROM

  • 0

I have the following two mysql_queries:

1.

$primary_img_query = "SELECT imgWidth, imgHeight FROM primary_images WHERE imgId=$imgId";
$primary_img_data = mysql_query($primary_img_query) or die('MySql Error' . mysql_error());

2.

$secondary_img_query = "SELECT imgWidth, imgHeight FROM secondary_images WHERE primaryId=$imgId";
$secondary_img_data = mysql_query($secondary_img_query) or die('MySql Error' . mysql_error());

What I need to do is find the largest value of both imgWidth and imgHeight from each query, and then find the largest value between the two found values. I need both said largest values to end up in variables.

All values in imgWidth and imgHeight are positive integers greater than zero.

Thanks for any help you can provide.


I was thinking I could put the results from both imgWidth and imgHeight in each query in separate arrays, then combine the arrays, and use max() to find the largest(highest) value. Would that work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:55:04+00:00Added an answer on May 25, 2026 at 6:55 am

    This query should give you MAX for the width and height given the two need not to be associated with anything. You could also filter the set. For example, by primaryId below, assuming the primaryId is a number, you want to filter for primaryId less than 2

    SELECT MAX(imgWidth) maxWidth, MAX(imgHeight) maxHeight FROM (
        SELECT imgHeight, imgWidth, primaryId FROM primary_images
        UNION 
        SELECT imgHeight, imgWidth, primaryId FROM secondary_images
      ) as MaxHeight
    WHERE primaryId < 2
    

    You would then store the results as variables then use it to size your container.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM
I have the following two queries: select count(*) from segmentation_cycle_recipients scr , segmentation_instance si
I have the following MySQL query: SELECT value_1, ( SELECT value_4 FROM table_1 WHERE
I have the following query in mysql 5.1.41: select distinct table_schema from information_schema.tables where
I have the following two classes, one inherits from the other Class A{ void
I have the following select statement: $wishes = mysql_query(select count(*) as how_many_total, PRprodinfo_id, main_category
I have the following two ActiveRecord queries in an application_helper.rb file: @left_menu = Page.select('id,
Let's assume we have MySQL table events from which we'll select a data. Now
I'm using parameterized queries with PHP I have the following two queries: SELECT username,question_text
I have the following two tables, affiliates and referrers. affiliates Table id loginid 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.