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

Imagine a database table that looks like this: create table [dbo].[user] ( id int
I have a db-table that looks like this: CREATE TABLE ItemPrice ( [Identity] INT
I have a stored procedure that looks something like: CREATE PROCEDURE my_procedure @val_1 INT,
At a glance, the database schema looks like this: The schema has to be
I want to have a database table that keeps data with revision history (like
My database is defined as the following CREATE TABLE [problems] ( [p_id] INTEGER NOT
My Current Database Structure: `images` `tags` `images_tags` ________________ ______________ ________________________ | id | title
We have this current database which we need to replace some tables by anther
I just copied my current database to a new database to find out only
Here is my current setup: Database Role - MyDbRole Schema - MySchema User -

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.