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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:16:30+00:00 2026-05-29T05:16:30+00:00

Okay so i got one table with people. One table with items that are

  • 0

Okay so i got one table with people. One table with items that are given away and one with items people want.

People:
Person_ID, Name

Giveaways:
Person_ID, Item_ID

Wishlist:
Person_ID, Item_ID

So i want a query that returns exchange suggestions for a certain user.

So if i want exchange suggestions for person A it should return a list of people that are giving away an item that person A wants, and want an item that person A is giving away.
The result should include: Person A’s item, name of person too make exchange with as well as id and item_ID.

  • 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-29T05:16:30+00:00Added an answer on May 29, 2026 at 5:16 am

    @SérgioMichels’ answer should be correct. But it doesn’t get the seller’s name, and it uses syntax that should (in my opinion) be avoided.

    So, here is an alternative…

    SELECT
      buyer.name          AS buyer,
      buyerWants.name     AS buyer_wants,      (assuming the items have names),
      buyerHas.name       AS buyer_has,
      seller.name         AS seller,
      sellerWants.name    AS seller_wants,
      sellerHas.name      AS seller_has
    FROM
      People              AS buyer
    INNER JOIN
      Wishlist            AS buyerWants
        ON buyerWants.person_id = buyer.person_id
    INNER JOIN
      Giveaways           AS sellerHas
        ON sellerHas.item_id = buyerwish.item_id
    INNER JOIN
      People              AS seller
        ON seller.person_id = sellerHas.seller_id
    INNER JOIN
      WishList            AS sellerWants
        ON sellerWants.person_id = seller.person_id
    INNER JOIN
      GiveAways           AS buyerHas
        ON  buyerHas.item_id = sellerWants.item_id
        AND buyerHas.person_id = buyer.person_id
    WHERE
      buyer.person_id = ?
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, so I got 2 tables. One holds the recipes, and the second all
Okay, Ive got a cog (toothed gear) that I have drawn in opengl. I
OKAY! Here's the situation. I've got a jQuery plugin that's animating a background-image in
I need some help with the design of a query. I've got one table
I've got a one line method that resolves a null string to string.Empty which
Okay, so I've got a class where one of the attributes is a callback
Okay, so I have a (SQLite) table called log wherein one column (time) is
Okay, I got this small program which tags (as in ID3v2.4 etc.) some music
Okay, so we've got this event. Awesome, right? We've also got a timer with
Okay, so I've got the following code shown below to create a dialog using

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.