Jump to content



Photo

Selecting Multiple Unsimilar Tables


  • Please log in to reply
2 replies to this topic

#1 MrLeche

MrLeche

    Newbie

  • Members
  • Pip
  • 11 posts

Posted 11 July 2011 - 9:46 PM

Hi,

I would like to know how you would select from multiple tables:

tableA
colx, coly, cola, colb, colc

and

tableB
col1, col2, cola, colb, colc

the tables only differ from the first 2 columns of each of them (tables) but I would like to have it SELECT * FROM "both of them"

actually the reason for that is I wanted to lay all out in a while() loop, and at the same time paginate it.

while tableA consist of older records, time-wise, it will be the first to be "echo-ed", I had problems paginating it if I do not join the query into a single query as opposed to querying tableA, then echo, then query tableB then echo.


thanks!
  • 0

#2 Antonio Conte

Antonio Conte

    Advanced Member

  • Members
  • PipPipPip
  • 1,055 posts
  • LocationOslo, Norway

Posted 11 July 2011 - 11:15 PM

SELECT *
FROM tableA, tableB
....

A tips thought; User more descriptive names for your tables and columns. :)
  • 0

#3 MrLeche

MrLeche

    Newbie

  • Members
  • Pip
  • 11 posts

Posted 12 July 2011 - 11:50 AM

SELECT *
FROM tableA, tableB
....

A tips thought; User more descriptive names for your tables and columns. :)



Sheez, that easy I was googling and resulted to JOINS, LEFT JOINS, ON AS... Thanks, I'll run a quickie.
  • 0