Distinct Records Based On One Field - fixed

2004-06-21 Thread PhistucK
I'm posting it again coz I did it all wrong. so here it is again:
I got a little problem.
I want to show distinct results based on only one field of the record,
field1.
Here's an example. I want to show records from Table1 & Table2 and each
number in field1\tfield1 must be output only once (unique), the last record
inserted with that number.
If my tables are:
Table1:
   field1 field2 field3
1 5Five   Five
2 4Four   Four
3 3Three Three
4 6Six  Six
5 8Eight  Eight
6 9Nine   Nine
Table2:
   tfield1 tfield2
1 5One
2 4Bla
3 5Blah
4 3Bluh
5 5Bla bla
5 6Bl.a
7 8B.La
8 9Lba
9 3LAb
I want to output this:
Output
field1 field2 field3  tfield2
1 4Four   Four   Bla
2 5FiveFive   Bla bla
3 6Six  Six Bl.a
4 8Eight  Eight  B.La
5 9Nine   Nine   Lba
6 3Three Three LAb

 Is there a way to do that? without making another table everytime I insert
records to the second? I mean, by an sql command?

 Thanks in advance.

PhistucK

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Distinct records based on one field

2004-06-21 Thread PhistucK
I got a little problem.
I want to show distinct results based on only one field of the record, field1.
Here's an example. I want to show records from Table1 and the number in field1 must 
not show more than once.
If my table is this:
Table1
  field1 field2 field3 field4 
  5 Five Five One 
  4 Four Four Bla 
  5 Five Five Blah 
  3 Three Three Bluh 
  5 Five Five Bla bla 
  6 Six Six Bl.a 
  8 Eight Eight B.La 
  9 Nine Nine Lba 
  3 Three Three LAb 

I want to output this:
Output
  field1 field2 field3 field4 
  5 Five Five Bla bla 
  6 Six Six Bl.a 
  8 Eight Eight B.La 
  9 Nine Nine Lba 
  3 Three Three LAb 



Is there a way to do that? without making another table everytime? I mean, by an sql 
command?

Thanks in advance.

PhistucK