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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:54:38+00:00 2026-06-18T00:54:38+00:00

There are three tables Users, Lists, Details. Here it is my table structure and

  • 0

There are three tables Users, Lists, Details. Here it is my table structure and data sample

userid username   |  list_id  list_val  user_id  |   detail_id   list_id   multipler
1      user1      |     1       500        1     |      1           1         3
2      user2      |     2       300        1     |      2           1         2
3      user3      |     3       600        1     |      3           2         1
                        4       100        2            4           2         1
                                                        5           3         4

SELECT
users.username,
SUM(lists.lists_var),
FROM
users
INNER JOIN lists ON users.userid = lists.user_id
GROUP BY
users.username
HAVING
(SELECT (exp(sum(log(COALESCE(details.multipler, 1))))) FROM details WHERE
details.list_id = lists.list_id) > 3

This query gives me result

user1 - 1400

But I want something IF multipler_total > 3 THEN SUM(list_val) so result must be:

user1 - 1100
  • 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-18T00:54:39+00:00Added an answer on June 18, 2026 at 12:54 am

    try this:

    SELECT
    users.username,
    SUM(lists.lists_var),
    FROM
    users
    INNER JOIN lists ON users.userid = lists.user_id
    INNER JOIN (SELECT list_id, SUM(multiplier) mult_total FROM details GROUP BY list_id) d
    ON d.list_id = lists.list_id and d.mult_total > 3
    GROUP BY
    users.username
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have users table. There are three other tables: developers, managers, testers. All of
In my database I have three tables: Users: UserID (Auto Numbering), UserName, UserPassword and
I have three tables specifying important columns below Users(Id, username) Groups(Id, groupname, creator) (creator
Say I have three tables, a table of users, a table of around 500
I'm trying to join THREE tables. The first table is transactions which contains details
Basicall I have three Tables Users Roles and USerRoles with Many to many Relationship.
I have three database tables: users emails invitations Emails are linked to users by
I have three tables which are defined as: class User(Base): __tablename__ = 'users' id
There are two tables. One is users info users, one is comments info comments.
I have three tables: User: UserId (pk) FirstName Lastname Messages: MessageId (pk) Heading Body

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.