View Single Post
  #1 (permalink)  
Old 10-19-2007, 01:17 AM
MichelleStillCantType MichelleStillCantType is offline
WebProWorld Member
 

Join Date: Jan 2005
Location: Ohio
Posts: 30
MichelleStillCantType RepRank 0
Default How to Query 2 Tables (Not a join?)

Uuuuughhhh! Frustration. This seems like it should be so simple and I'm lost.

I want to randomly rotate (with each load or refresh) a section of text, corresponding images and links, etc. with a limit of 1 on a specific webpage. (The text I show on this page is also limited by a "WHERE" statement).

All is great if I only query from one table. Simple enough...

SELECT * FROM tableA WHERE level= '1' ORDER BY reverse(rand()) LIMIT 1

I randomly get my info from tableA with each refresh just fine with the above code.

BUT...

I also need to select from tableB, tableC, tableD and so on. All fields are the same in tableA, tableB and so on. I've tried...

SELECT * FROM tableA,tableB,tableC WHERE level= '1' ORDER BY reverse(rand()) LIMIT 1

...amongst other things. I'm just not getting it. Is something that seems so simple impossible?

Only one section of text can show at a time and this will be from up to 50 tables if I get it worked out.

I do SOME programming. Minimal. Enough to do what I need here and there (like not having to update 100's of html pages for one little alphabetical addition) but you wouldn't call me a programmer. Help? In simple terms..OR even exact code
Reply With Quote