php forum
php mysql forum
php mysql smarty
 
Topic Options
#281354 - 10/27/04 03:25 AM Order one table by another in MySQL?
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria

   Order one table by another in MySQL? to Del.icio.us Add to del.icio.us
  Digg Order one table by another in MySQL? Digg it
Trying to fix this bug:<br />http://www.ubbcentral.com/boards/showflat.php/Cat/0/Number/39688<br /><br />Is there a way in MySQL to Order the results retreived from the the Boards table by the sort order of the Categories table? They are related by the category number which is on both tables.

Top
#281355 - 10/27/04 04:05 AM Re: Order one table by another in MySQL? [Re: domain123]
Anno Offline
Code Monkey

Registered: 05/23/01
Posts: 562
Loc: Austria
OK, found a solution.<br />As an example for the postlist jump menu:<br /><br />In ubbt.inc.php<br />in function jump_box<br /><br />Find<br /><br /> $query = "<br /> SELECT Bo_Number,Bo_Title,Bo_Keyword,Bo_Cat,Bo_CatName,Bo_Sorter<br /> FROM {$config['tbprefix']}Boards<br /> WHERE Bo_Active='1'<br /> $groupquery<br /> $thiscat<br /> ORDER BY Bo_Cat,Bo_Sorter<br /><br />Replace with<br /><br /> $query = "<br /> SELECT t1.Bo_Number,t1.Bo_Title,t1.Bo_Keyword,t1.Bo_Cat,t1.Bo_CatName,t1.Bo_Sorter<br /> FROM {$config['tbprefix']}Boards AS t1<br /> LEFT JOIN {$config['tbprefix']}Category AS t2 ON t1.Bo_Cat = t2.Cat_Entry<br /> WHERE Bo_Active='1'<br /> $groupquery<br /> $thiscat<br /> ORDER BY t2.Cat_Number ,t1.Bo_Sorter

Top


Who's Online
0 Registered (), 23 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Blogs, love em or hate em?
by AllenAyres
10/07/08 02:05 PM
What do you use to edit the files
by Ian_W
10/05/08 03:33 PM
BeyondCompare v3.00
by Ian_W
10/05/08 03:32 PM
Glossy Black Theme with Image Reflection
by Gizmo
10/05/08 02:17 PM
ShareThis
by Gizmo
09/28/08 05:06 AM
[7.3] Viewing MySQL logfiles made easier
by AllenAyres
09/27/08 09:57 PM
Looking for a simple upload script
by Murphdog
09/26/08 08:45 PM
New Mods
[7.3] Viewing MySQL logfiles made easier
by blaaskaak
09/24/08 05:39 PM
[7.3.1] add search to showmembers page
by blaaskaak
09/07/08 04:50 AM
Multiple Identity Detector
by
12/30/06 06:39 PM
Newest Members
pisa666, ghengis317, NitroX, Dogan, EliYah-
13345 Registered Users
Top Posters Last 30 Days
AllenAyres 12
blaaskaak 7
tackaberry 5
FREAK1 5
Chris Bale 4
Ian_W 4
Gizmo 4

 

 

 
fusionbb message board php hacks