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

  • SEARCH
  • Home
  • 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 8290211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:44:00+00:00 2026-06-08T12:44:00+00:00

OK this is a bit tricky but basically in my SQL statement im comparing

  • 0

OK this is a bit tricky but basically in my SQL statement im comparing prices between fields in each row to get the lowest value returned, now the issue is that each value has a link.

Would there be a way to return the correct link depending on the lowest value in an SQL statement?

below is my SQL statement.

SELECT 
   title, 
   my_value, 
   my_ink,

   LEAST(site_a_value, site_b_value, site_c_value) AS lowest_value, 

   site_a_link,
   site_b_link,
   site_c_link

   FROM STOCK

so for example if site_b had the lowest value I would only want site_b_link to be returned.

  • 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-06-08T12:44:02+00:00Added an answer on June 8, 2026 at 12:44 pm

    Try

    SELECT     title,
                my_value,
                my_ink,
                LEAST(site_a_value, site_b_value, site_c_value) AS lowest_value,     
                case LEAST(site_a_value, site_b_value, site_c_value)
                when site_a_value then site_a_link
                when site_b_value then site_b_link
                when site_c_value then site_c_link end AS lowest_value_link,
    FROM STOCK 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a bit tricky setup but... I have this Silverlight project that
This is a bit tricky to explain, but I will do my best. Say
This is a bit tricky to explain but I will try my best to
Bit tricky to communicate but hope this makes sense. I have 8 div containers
This is a bit tricky, but what I want, in a simple way, is
Bit tricky question but this saves lot of time if you have to modify
I might be being a bit thicky here but please answer me this. Consider
This is a deceptively tricky little bit of HTML/JS that has either me or
IS this bit of code in PHP/mysql considered a stored procedure? $sql = 'SELECT
This is getting little bit tricky. I am using state pattern in my application

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.