I think you still did it wrong, assuming the first column is IDs, but no matter. How do you determine which row from Table2 is "the last record inserted with that number."?

Michael

PhistucK wrote:

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 5        Five   Five
2 4        Four   Four
3 3        Three Three
4 6        Six      Six
5 8        Eight  Eight
6 9        Nine   Nine
Table2:
   tfield1 tfield2
1 5        One
2 4        Bla
3 5        Blah
4 3        Bluh
5 5        Bla bla
5 6        Bl.a
7 8        B.La
8 9        Lba
9 3        LAb
I want to output this:
Output
    field1 field2 field3  tfield2
1 4        Four   Four   Bla
2 5        Five    Five   Bla bla
3 6        Six      Six     Bl.a
4 8        Eight  Eight  B.La
5 9        Nine   Nine   Lba
6 3        Three 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]



Reply via email to