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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:27:57+00:00 2026-05-16T15:27:57+00:00

example if i have follow table company one ( cid = 1 ) following

  • 0

alt text

example if i have

follow table
company one ( cid = 1 ) following two ( cid = 2 )
company one ( cid = 1 ) following three( cid = 3 )

feeds table
company one ( cid = 1 ) type 'product' description 'hello ive updated a product';
company two ( cid = 2 ) type 'product' description 'hello ive updated a product im from company 2';
company three ( cid = 3 ) type 'shoutout' description 'hello ive i got a shoutout im company 3';
company one ( cid = 1 ) type 'product' description 'hello ive updated my second product';

question

how do i get all the feeds.description from the company that my company ( example here is cid = 1 ) ?

heres my simple pdo sql to get just mine.

    $data['feeds']['cid'] = 1;

    return $this->db->fetchAll("SELECT feeds.type, feeds.$type, feeds.cid, feeds.time, companies.name FROM feeds, companies WHERE 
    feeds.cid = :cid AND companies.cid = :cid ORDER BY feeds.fid DESC LIMIT 0, 5", $data['feeds']);

this will display
hello ive updated a product
hello ive updated my second product

maybe something like this ? ( fail )

    $data['feeds']['cid'] = 1,2,3;

    return $this->db->fetchAll("SELECT feeds.type, feeds.$type, feeds.cid, feeds.time, companies.name FROM feeds, companies WHERE 
    feeds.cid = :cid AND companies.cid = :cid ORDER BY feeds.fid DESC LIMIT 0, 5", $data['feeds']);

this should be displaying like
hello ive updated a product
hello ive updated a product im from company 2
hello ive i got a shoutout im company 3
hello ive updated my second product

or simpler get feeds.description from each follow.following ( cid = 1,2,3,etc ) from me. ( cid = 1)
or if twitter get all my friends status ( friends that i follow )

edit*

some good guys at irc mysql said to use joins. but i just dont get it.
what i get is this

fetch all the follow.following from cid = me ( example cid = 1 )

then

SELECT * FROM feeds WHERE feeds.cid = IN (2,3,cid that im following ( see follow.following )) 

anyone can give me an example for joins in this problem ?

  • 1 1 Answer
  • 3 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-16T15:27:58+00:00Added an answer on May 16, 2026 at 3:27 pm

    So, assuming that the question is “How do i get all the feeds.description from the company that my company IS FOLLOWING?” you want to join using the following key:

    select 
    companies.name, 
    feeds.type, 
    feeds.description 
    from follow 
    inner join feeds on (follow.following = feeds.cid or follow.cid = feeds.cid)
    inner join companies on (feeds.cid = companies.cid)
    where follow.cid = :cid
    order by feeds.fid desc 
    limit 5;
    

    This should list all of the companies that your :cid (1) is following.

    EDIT: Feeds should include my company’s feeds + feeds my company is following.

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

Sidebar

Related Questions

I'm trying to follow http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/ And have created a very simple example http://jsfiddle.net/6wbZQ/ It's
I have the follow structure (example): trunk/ branches/v1.0.0 branches/v1.0.1 tags/v1.0.0 My question is: The
I'm a beginner with Json, I follow this tutorial the example I have written
Ok, in my code I have for example, this: $('.follow').click(function(){ var myself = $(this);
I have a ruby file as follows: module Example class Myclass def t_st Hello
If you have a url such as the one as follows: http://www.example.com/400x200 is it
Let's say I have a site with multiple links as follows: www.example.com/product/1 www.example.com/product/2 www.example.com/product/3
I have a database that is similar to the following: create table Store(storeId) create
I have a Sqlite database that has a table consisting of company information (Companies)
Suppose I have the following tables: Table1: FLP, FNAME, LNAME Table2: FLP, Job, Company,

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.