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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:44:20+00:00 2026-06-03T08:44:20+00:00

Here an example my database structure.. uid email name ——————————- 1 john@gmail.com John 2

  • 0

Here an example my database structure..

uid  email            name
-------------------------------
1    john@gmail.com   John
2    peter@gmail.com  Peter
3    colin@gmail.com  Colin

book table

book_id  book_name
-------------------
1        PHP
2        MySQL
3        Javascripts
4        CSS

history table

history_uid  history_bookid
---------------------------
1            1
1            2
1            3
2            1
2            3
3            3

Current statement including multi select query on history.history_bookid

SELECT users.uid,
       users.email,
       users.`name`,
       history.history_uid,
       history.history_bookid,
       GROUP_CONCAT(history.history_bookid) AS BookID,
       GROUP_CONCAT(book_name)              AS bookTitles
FROM   users
       INNER JOIN history
         ON users.uid = history.history_uid
       INNER JOIN book
         ON history.history_bookid = book.book_id
WHERE  history.history_bookid = 1
        OR history.history_bookid = 3
GROUP  BY users.uid  

The results

uid email            name   history_uid  history_bookid  BookID   bookTitles
---------------------------------------------------------------------------------
1   john@gmail.com   John   1            3               3,1      Javascripts,PHP
2   peter@gmail.com  Peter  2            1               1,3      PHP,Javascripts
3   colin@gmail.com  Colin  3            3               3        Javascripts

Question :

How do I get full list of books was read by uid = 1? Example output I want is including all book in history table

uid email            name   history_uid  history_bookid  BookID   bookTitles
---------------------------------------------------------------------------------
1   john@gmail.com   John   1            3               1,2,3    PHP,MySQL,Javascripts
2   peter@gmail.com  Peter  2            1               1,3      PHP,Javascripts
3   colin@gmail.com  Colin  3            3               3        Javascripts
  • 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-03T08:44:21+00:00Added an answer on June 3, 2026 at 8:44 am

    How do I get full list of books was read by uid = 1?

    Add that as a filter option to your WHERE clause:

    WHERE history.history_bookid IN (1,3) OR users.uid = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my database one table is there with say name as tableA.the structure of
Could someone give me an idea how to create this database structure. Here is
So firstly here is the relevant table structure: TUBE_VIDEOS ------ id video_name TAGS ----
Possible Duplicate: Schema for a multilanguage database Here's an example: [ products ] id
Ok so i have a database table called requests with this structure mysql> desc
I have a mysql table with contents the structure is here: I want to
Here is model of my table structure. Three tables. ---------------- ---------------------------- ------------------------------- |possibilities |
I'm trying to optimize database queries for a Django app. Here's a simplified example:
I have something like Facebook's Wall build on PHP that uses MySQL database. Structure:
This is based on the example from the book: Pro WPF and Silverlight MVVM

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.