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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:34:40+00:00 2026-06-17T04:34:40+00:00

i have a table with only one column consisiting of 5 colours- colour ——-

  • 0

i have a table with only one column consisiting of 5 colours-

colour
-------
red
black
white
green 
orange

I want to get all the combinations like

(red,orange)
(black,white)
.
.
.
etc except the identical ones.i have tried to cross join the table with itself .

select * 
from table1 cross join table1

but i did not get the desired answer.it returned all the combinations.also identical ones.how can i get it???is there any other way to do this without creating another table???

  • 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-17T04:34:41+00:00Added an answer on June 17, 2026 at 4:34 am

    If by identical you mean pairs like (white, white) perhaps this is what you want:

    SELECT a.color, b.color
    FROM colors a
    CROSS JOIN colors b
    WHERE a.color != b.color
    

    If by identical you additionally mean preserve only one of (white, black) or (black, white) perhaps this is what you want:

    SELECT a.color, b.color
    FROM colors a
    CROSS JOIN colors b
    WHERE a.color > b.color
    

    The important part is to reject the elements you don’t want after you perform the cross-join.

    Note that this won’t create any new tables or modify existing ones. a and b are merely two different aliases for the same table colors. The table has only one column color, but since the table is present twice in the SELECT, you need to distinguish both (conceptual, not factual!) instances of the colors table.

    You can’t do without a join (then you’d have too few rows), nor you can easily do without aliases (you have to refer to both columns to reject some rows) nor there is a reason to assign aliases.

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

Sidebar

Related Questions

I want the table to have 100% width, but only one column from it
I have a table with one and only one column, which is an identity
Suppose we have a table Users that has only one column UserId which is
I have a table mytable in ORACLE database having only one column Roll_no like
I'm useing SQL Ser 2008 and have a large table with only one column
I have a completely blank custom table (DatabaseLogFixLog) with only one field/column called refRecId.
I have a very simple table with only one column (+ the key column).
I have two tables: tab1 and tab2. Every table has only one VARCHAR(MAX) column.
I have a table called create with only one column called name of type
I have a table Administrator with only one column, adminId which is the primary-key.

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.