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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:22:02+00:00 2026-05-22T20:22:02+00:00

My current database looks like CREATE TABLE sites( siteId INT(11) AUTO_INCREMENT, siteType VARCHAR(255), siteName

  • 0

My current database looks like

CREATE TABLE sites(
siteId INT(11) AUTO_INCREMENT,
siteType VARCHAR(255),
siteName VARCHAR(255),
siteDomain VARCHAR(255),
PRIMARY KEY(siteId)
);
CREATE TABLE siteSites(
parentId INT(11),
childId INT(11)
)

I’m trying to join all the tables and fetch all data.
like:

<?php
$q=mysql_query("SELECT * FROM sites s1, siteSites, sites s2 WHERE s1.siteId=parentId AND s2.siteId=childId");
$row=mysql_fetch_array($q);
?>

and than i want to get both the info from ‘s1’ and ‘s2’ out of the $row variable.
is this possible and if it is than how do i do it?

thank you

  • 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-22T20:22:03+00:00Added an answer on May 22, 2026 at 8:22 pm
    SELECT s1.siteId as ParentSiteId, s1.siteType as ParentType, s1.siteName as ParentName, s1.siteDomain as ParentDomain,
           s2.siteId as ChildSiteId,  s2.siteType as ChildType,  s2.siteName as ChildName,  s2.siteDomain as ChildDomain
        FROM sites s1
            INNER JOIN siteSites ss
                ON s1.siteId = ss.parentId
            INNER JOIN sites s2
                ON ss.childId = s2.siteId
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a stored procedure that looks something like: CREATE PROCEDURE my_procedure @val_1 INT,
In our inventory database (SQL Server 2008 std edition) we have a table (called
I have the following table of counters: CREATE TABLE cache ( key text PRIMARY
Here is my current problem. I am working with the chat module and I'm
Good Morning All, I have loaded over 1,300 blurbs into my client's database with
I saw this question: how to save tags(keywords) in database? Good answer for how
when i try to insert each line into my oracle database i get an
I'm working on a catalog site where users can browse categories. Categories can contain
I'm building a heavily CRUD based ASP.NET website and I've got to the phase
SQL Server 2008 Ent ASP.NET MVC 2.0 Linq-to-SQL I am building a gaming site,

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.