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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:55:49+00:00 2026-05-22T01:55:49+00:00

This is my tables and structure Shoutbox SID //PK Title //Title shoutbox_follower SID UID

  • 0

This is my tables and structure

Shoutbox

  • SID //PK
  • Title //Title

shoutbox_follower

  • SID
  • UID //User ID

Shouts

  • SID
  • Text //Shouts

I want to get the last 1 (latest) shouts(Shouts.Text) for each Shoutbox, which the user is following


i tried this but it did not worked

select shoutbox_follower.SID,shoutbox.title, shouts.text from shoutbox_follower, shoutbox, shouts where shoutbox_follower.uid=1;

But i can do the work with multiple query

SELECT SID from shoutBox_Follower where UID=5
SELECT SID,TEXT from Shouts where SID in ($boxList) order by id desc limit 1
SELECT Title from Shoutbox where SID=? limit 1
  • 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-22T01:55:50+00:00Added an answer on May 22, 2026 at 1:55 am

    You can combine the queries, in cases like this:

    SELECT SID,
           (select TEXT
           from Shouts
           where Shouts.SID = shoutBox_Follower.SID
           order by Shouts.SID desc limit 1
           ) as shout_text
    from shoutBox_Follower
    where UID=5
    

    It performs very fast for small numbers of rows (assuming you’ve the needed indexes, of course). Based on your third query, the title can be fetched using a simple inner join.

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

Sidebar

Related Questions

My MySQL tables structure is like this. USER uid FRIENDS fuid,fuid2,fapproved For each friend
My MySQL tables structure is like this. USER int id varchar username FRIEND_LIST int
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT
Ok: This is some of my table structure that matters here CaseStudyID int Title
See the tables structure here. I have this sql: SELECT `feed_entries` . * FROM
I have this two tables, -- -- Table structure for table `t1` -- CREATE
I have a following tables/classes structure in Linq to entities. Books { bookId, Title
Simplified table structure (the tables can't be merged at this time): TableA: dts_received (datetime)
In report design, I have 2 tables (Current and Proposed) the structure like this:

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.