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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:41:53+00:00 2026-06-13T17:41:53+00:00

I was advised to create a new question based on my previous one so

  • 0

I was advised to create a new question based on my previous one so here it is :

I have on my website a list of product, each user can create his own savings based on these products. So several users can create their own savings based on the same product. So when one user create a saving I add in the database a saving with the user_id and the product_id he refers to. Now, on one page I want to display all the savings from the other users (excluding current_user) but, as many user can create a saving based on the same product I want to display these only once.If several users create a saving based on product X I want it only displayed once,thanks

The saving table has these field :

id
product_id
user_id
price
saved

What I did is what is posted on this question :
Squeel request and Heroku, Postgres: Error using GROUP BY and ORDER

I cannot get it working properly on heroku (postgres). If anyone can help me writing the query for Rails or for Squeel that would be awesome thanks !

  • 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-13T17:41:54+00:00Added an answer on June 13, 2026 at 5:41 pm

    Well Craig thanks for your help I ended up doing that and it’s working on PG in local !

    Saving.select("DISTINCT ON (savings.product_id) * ").where{product_id.not_in(current_user_savings.select{product_id})}.group("savings.user_id, savings.updated_at, savings.id, savings.product_id, savings.price,savings.wishlist_id, savings.saved, savings.created_at")
    

    Having that issue made me switch my db from mysql to pg in dev so no more surprise in heroku !

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

Sidebar

Related Questions

I was advised in a previous question that I didn't need to maintain the
I used to have tables before to display the content and people here advised
This is my first question on stackflow. As you can tell, I am new
Hello I have one question about using genetic in correct way. please look at
I have done some research but can't find a reliable answer to my question.
When using implicit waits, as advised here , I still sometimes want to assert
As a newbie, I have been advised to preferably use heredoc compared to too
I initially asked this on Superuser, but somebody advised me to repost here. I
Please consider the following: we have a Spring bean B which is advised with
I have recently been advised that for my current rails app relationships I should

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.