PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Order By question
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Order By question

Réponse
 
LinkBack Outils de la discussion
Vieux 13/02/2008, 17h38   #1
Vamp4L
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Order By question

Is there any way to order across multiple tables at the same time?

For example, I have 2 separate tables, A and B that contain names of
users
A third table contains fields which relate A and B
Is there a way to order by names from table A and B simultaneously?
Like maybe combine A and B and the sort that result?
  Réponse avec citation
Vieux 13/02/2008, 18h07   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Order By question

Vamp4L wrote:
> Is there any way to order across multiple tables at the same time?
>
> For example, I have 2 separate tables, A and B that contain names of
> users
> A third table contains fields which relate A and B
> Is there a way to order by names from table A and B simultaneously?
> Like maybe combine A and B and the sort that result?


Are you JOINing them or UNIONing them?


  Réponse avec citation
Vieux 13/02/2008, 18h20   #3
Peter H. Coffin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Order By question

On Wed, 13 Feb 2008 09:38:18 -0800 (PST), Vamp4L wrote:
> Is there any way to order across multiple tables at the same time?
>
> For example, I have 2 separate tables, A and B that contain names of
> users
> A third table contains fields which relate A and B
> Is there a way to order by names from table A and B simultaneously?
> Like maybe combine A and B and the sort that result?


You can always select data into a temporary table and do your stuff
against that. There may be a way to do it against the tables as is, but
we'd need to know a lot more about the specifics of the tables involves
and the interrelationships, and you'll probably get a lot of advice
about how to rearrange your whole database in the process... Not a
criticism, but for most things with SQL, if what you want is really hard
to figure out, it's *probably* because what you want wasn't designed in
rather than because the task is inherantly complicated. And, if you want
to do this thing more than once, it's probably worth fixing a clunky
design so you don't have the same kind of problem next time.

--
64. I will see a competent psychiatrist and get cured of all extremely
unusual phobias and bizarre compulsive habits which could prove to
be a disadvantage.
--Peter Anspach's list of things to do as an Evil Overlord
  Réponse avec citation
Vieux 13/02/2008, 22h37   #4
Michael Austin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Order By question

Peter H. Coffin wrote:
> On Wed, 13 Feb 2008 09:38:18 -0800 (PST), Vamp4L wrote:
>> Is there any way to order across multiple tables at the same time?
>>
>> For example, I have 2 separate tables, A and B that contain names of
>> users
>> A third table contains fields which relate A and B
>> Is there a way to order by names from table A and B simultaneously?
>> Like maybe combine A and B and the sort that result?

>
> You can always select data into a temporary table and do your stuff
> against that. There may be a way to do it against the tables as is, but
> we'd need to know a lot more about the specifics of the tables involves
> and the interrelationships, and you'll probably get a lot of advice
> about how to rearrange your whole database in the process... Not a
> criticism, but for most things with SQL, if what you want is really hard
> to figure out, it's *probably* because what you want wasn't designed in
> rather than because the task is inherantly complicated. And, if you want
> to do this thing more than once, it's probably worth fixing a clunky
> design so you don't have the same kind of problem next time.
>



Or create a view of the data and sort against the view... but really
depends on how you are "relating" the data (join, union etc...)
  Réponse avec citation
Vieux 14/02/2008, 14h35   #5
Vamp4L
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Order By question

looking at using views....its a join operation...i think i might end
up restructuring the db itself a little bit. thanks for the
suggestions
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h25.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13812 seconds with 13 queries