|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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...) |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 |
|
![]() |
| Outils de la discussion | |
|
|