Oops, I found a problem again. What I really need is to find the last entry made for id = 100 and 200. My answer that I am looking for is cindi and angie since they are the last entries. The min() worked for some items when I used this on productions record which contains a hundred or so Items. Any suggestions?
Thanks
Nick Patel
>I think changing MAX to MIN and adding a GROUP BY clause may help you get there, but "James" is still going to be at that top of the list for ID 100:
>
>
>SELECT Table1.id, Table1.vname, MIN(Table2.name);
> FROM Table1 INNER JOIN Table2 ;
> ON Table1.id = Table2.id ;
> GROUP BY 1
>
>
>To fix that, you can change MIN(Table2.name) to MIN(LOWER(Table2.name))
>
>>I am trying to get the last value entered as a character in a table using max command: Here is what my test data looks like
>>
>>table1:
>>id vname
>>============
>>100 veh1
>>200 veh2
>>
>>
table2:
>>id name
>>=============
>>100 "James"
>>200 "tammy"
>>100 "john"
>>100 "cindi"
>>200 "angie"
>>
>>I am trying to get max value from table2 "name" column for each vname in table1 using sql statement. Here is the statement that I did but it didn't produce right results.
>>
>>
SELECT Table1.id. Table1.vname, max(Table2.name);
>> FROM fleet!table1 INNER JOIN fleet!table2 ;
>> ON Table1.id = Table2.id
>>
>>
>>I need the results to be
>>
>>
>>100 veh1 "cindi"
>>200 veh2 "angie"
>>
>>I'm I doing the max wrong on characters? What is the correct way to do it.
>>
>>Thanks
>>Nick Patel