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 6934113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:55:07+00:00 2026-05-27T11:55:07+00:00

This is probably a bad example, but I think it’s quite simple. Let’s say

  • 0

This is probably a bad example, but I think it’s quite simple.
Let’s say a web search engine (e.g. Google) is retrieving results (links to websites) of a search performed by the user and it’s supposed to order them according to a given priority of languages and countries at the same time. Say,

Language priorities

 1. English
 2. Spanish
 3. Italian
 ...

Country priorities

 1. USA
 2. England
 3. Canada
 4. Spain
 5. Mexico
 ...

So, the result would be something ordered like

Websites in english and from the USA
Websites in spanish and from the USA or in english and from England

...

Websites in italian and from Mexico (?).

A query like

SELECT url FROM websites
WHERE (
 language = english
 OR language = spanish
 OR language = italian
 ) AND (
 country = USA
 OR country = England
 OR country = Canada
 OR country = Spain
 OR country = Mexico)

obviously wouldn’t work because it provides a condition, not a priority. Using ORDER BY language or ORDER BY timezone wouldn’t work either because it orders it alphabetically. So, how is the best way to go about this in SQL?

  • 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-27T11:55:08+00:00Added an answer on May 27, 2026 at 11:55 am

    Assuming that the languages and countries are in their own tables and that the websites table references those two, you order by the two fields that hold the priority of each table..

    something like

    SELECT 
        wesbites.url 
    FROM 
        websites 
        INNER JOIN languages on websites.languageId = languages.id
        INNER JOIN countries on websites.countryId = countries.id
    ORDER BY
        languages.priority,
        countries.priority
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably something simple I'm overlooking but my google-fu isn't turning anything up
This probably has a simple answer, but I must not have had enough coffee
I know this probably really simple but Im not sure what im doing wrong...
Ok, this probably has a really simple answer, but I've never tried to do
This probably sounds really stupid but I have noo idea how to implement jquery's
This probably sounds like a terrible idea at first glance, but here is my
I am using ASP.Net MVC but this probably applies to all MVC patterns in
Okay, so this probably sounds terribly nefarious, but I need such capabilities for my
OK, this probably is supposed to be the easiest thing in the world, but
Say we have this hyper simple class hierchy: public class SomeMath { public int

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.