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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:54:39+00:00 2026-05-25T23:54:39+00:00

Edit: I removed the confusing stuff and I wanted to simplify what I want

  • 0

Edit:

I removed the confusing stuff and I wanted to simplify what I want to accomplish:

Let’s say John had 2 baskets and 1 of them contained 1 stone, 2 marbles and 2 sticks, the other one contained 2 stones and 2 sticks.

Eric had 1 basket which contained 3 bottles, 2 caps and 1 stone.

Meanwhile Jack had 1 basket which contained 1 stick. Also, Jack has a stone somewhere but it’s not inside his basket yet.

For the purpose of this query, let’s say we’re focusing on Jack’s items. So we would go over everybody’s baskets and see which basket looks pretty much the same as all the items he has overall (a) without thinking whether Jack’s items are inside a basket or not and (b) only compare to Jack’s items with items that are inside other people’s baskets, not outside.

This would be the ideal end result when searching which baskets Jack can match the easiest with all his items regardless of where his items are currently:

Fact:

  • Jack has in total 1 stick and 1 stone.

Result:

  • 1st: John’s second basket containing 2 stones and 2 sticks
  • 2nd: John’s first basket containing 1 stone, 2 marbles and 2 sticks
  • 3rd: Eric’s basket containing 3 bottles, 2 caps and 1 stone
  • 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-25T23:54:40+00:00Added an answer on May 25, 2026 at 11:54 pm

    This will do what you asked for a single basket:

    SELECT SUM(item.qty/(SELECT sum(qty) total FROM basket WHERE bid = xxx)
           * 1/all_item.qty) likeness, basket.bid, all_basket.bid all_bid
    FROM basket JOIN item USING (bid)
         LEFT JOIN
         (basket all_basket JOIN item all_item USING (bid))
         USING (iid)
    WHERE basket.bid = xxx
    GROUP BY basket.bid, all_basket.bid
    ORDER BY likeness DESC
    

    It’s probably possible to join this to the users table to do all his baskets at once. Then wrap it in yet another query to find the best match.

    Try this first, and let me know if it works. If it does I’ll see if I can do that part tomorrow.

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

Sidebar

Related Questions

I have an update panel in a repeater (Edit: I removed Runat and Id
have downloaded Orca to edit an MSI file. I want to remove some banner
EDIT: Removed the files from the server http://www.jdxsolutions.com/newsite/index.html http://www.jdxsolutions.com/newsite/default.css This is a layout I've
EDIT : removed reference to C# as the only accepted answer is about Java.
Is there a way to remove duplicate (key-value) pairs from NSDictionary ? EDIT: My
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business
EDIT: This question is more about language engineering than C++ itself. I used C++

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.