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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:21:05+00:00 2026-05-15T14:21:05+00:00

here’s my problem: I have an SQL query that makes 4 calls to a

  • 0

here’s my problem: I have an SQL query that makes 4 calls to a lookup table to return their values from a list of combinations in another table. I finally got this working, and for some reason, when I run the query without DISTINCT, I get a ton of data back, so I’m guessing that I’m either missing something or not doing this correctly. It would be really great if this would not only work, but also return the list alphabetically by the first colour name.
I’m putting my SQL here I hope I’ve explained this well enough:

SELECT DISTINCT 
    colour1.ColourID AS colour1_ColourID, 
    colour1.ColourName AS colour1_ColourName, 
    colour1.ColourHex AS colour1_ColourHex, 
    colour1.ManufacturerColourID AS colour1_ManufacturerColourID, 
    colour2.ColourID AS colour2_ColourID, 
    colour2.ColourName AS colour2_ColourName, 
    colour2.ColourHex AS colour2_ColourHex, 
    colour2.QEColourID2 AS colour2_QEColourID2, 
    colour3.ColourID AS colour3_ColourID, 
    colour3.ColourName AS colour3_ColourName, 
    colour3.ColourHex AS colour3_ColourHex, 
    colour3.QEColourID3 AS colour3_QEColourID3, 
    colour4.ColourID AS colour4_ColourID, 
    colour4.ColourName AS colour4_ColourName, 
    colour4.ColourHex AS colour4_ColourHex, 
    colour4.QEColourID4 AS colour4_QEColourID4, 
    Combinations.ID, 
    Combinations.ManufacturerColourID AS Combinations_ManufacturerColourID, 
    Combinations.QEColourID2 AS Combinations_QEColourID2, 
    Combinations.QEColourID3 AS Combinations_QEColourID3, 
    Combinations.QEColourID4 AS Combinations_QEColourID4, 
    Combinations.ColourSupplierID, 
    ColourSuppliers.ColourSupplier 
FROM 
    ColourSuppliers INNER JOIN 
    (
        colour4 INNER JOIN 
        (
            colour3 INNER JOIN 
            (
                colour2 INNER JOIN 
                (
                    colour1 INNER JOIN Combinations ON 
                     colour1.ColourID=Combinations.ManufacturerColourID
                ) ON colour2.ColourID=Combinations.QEColourID2
            ) ON colour3.ColourID=Combinations.QEColourID3
        ) ON colour4.ColourID=Combinations.QEColourID4
    ) ON ColourSuppliers.ColourSupplierID=Combinations.ColourSupplierID 
WHERE Combinations.ColourSupplierID = ?

Thanks
Steph

  • 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-15T14:21:06+00:00Added an answer on May 15, 2026 at 2:21 pm

    It looks as though you’ve probably got multiple records for each set of four colour combinations in the Combinations table – posting the structure of the table might help us to work it out.

    Adding the clause order by colour1.ColourName to the end of the query should sort it alphabetically by the first colour name.

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

Sidebar

Related Questions

Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here is the problem that I am trying to solve. I have two folders
Here's a query that works fine: SELECT rowid as msg_rowid, a, b, c FROM
Here is the issue I am having: I have a large query that needs
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here is my problem : I have a post controller with the action create.
Here is my query: SELECT * FROM [GeoName] WHERE ((-26.3665122100029-Lat)*(-26.3665122100029-Lat))+((27.5978928658078-Long)*(27.5978928658078-Long)) < 0.005 ORDER BY
Here is my code (Say we have a single button on the page that
here is my query: FB.api( { method: 'fql.multiquery', queries: { 'friends':'SELECT uid1 FROM friend
Here's a problem I ran into recently. I have attributes strings of the form

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.