Click here to Skip to main content
15,437,758 members
Home / Discussions / Database
   

Database

 
QuestionLoading column having $ sign to SQL Server... Pin
notes4we13-Oct-08 7:56
Membernotes4we13-Oct-08 7:56 
AnswerRe: Loading column having $ sign to SQL Server... Pin
Wendelius13-Oct-08 9:22
mveWendelius13-Oct-08 9:22 
QuestionArchiving a record Pin
Bolivarian13-Oct-08 7:07
MemberBolivarian13-Oct-08 7:07 
AnswerRe: Archiving a record Pin
Wendelius13-Oct-08 9:25
mveWendelius13-Oct-08 9:25 
GeneralRe: Archiving a record Pin
Bolivarian14-Oct-08 0:12
MemberBolivarian14-Oct-08 0:12 
GeneralRe: Archiving a record Pin
Wendelius14-Oct-08 4:54
mveWendelius14-Oct-08 4:54 
QuestionLEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
polishprogrammer13-Oct-08 7:05
Memberpolishprogrammer13-Oct-08 7:05 
AnswerRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
Wendelius13-Oct-08 7:36
mveWendelius13-Oct-08 7:36 
Most likely the reason is in your group by section. You group on two columns so you'll get as many rows as there are valid combinations present. But then on your join you use only one column (SerialNumber).

If you want the latest record based on maximum ID and the maximum of id should be fetched based on serialnumber, it may be simpler to use correlated scalar at select portion (there may be typos):
SELECT Details.*, 
       (SELECT Results.VE
        From Results r1
        WHERE Details.SN = r1.SerialNumber
        AND   ID = (SELECT MAX(ID) 
                    FROM Results r2
                    WHERE Details.SN = r1.SerialNumber)
FROM Details;
Hope this helps,

Mika

The need to optimize rises from a bad design.

My articles[^]

GeneralRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
polishprogrammer13-Oct-08 11:01
Memberpolishprogrammer13-Oct-08 11:01 
GeneralRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
Wendelius13-Oct-08 18:12
mveWendelius13-Oct-08 18:12 
GeneralRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
polishprogrammer14-Oct-08 3:38
Memberpolishprogrammer14-Oct-08 3:38 
GeneralRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
Wendelius14-Oct-08 5:02
mveWendelius14-Oct-08 5:02 
GeneralRe: LEFT JOIN - GET ONLY ONE RESULT FROM RIGHT TABLE Pin
polishprogrammer15-Oct-08 7:16
Memberpolishprogrammer15-Oct-08 7:16 
QuestionMS DTC has cancelled the transaction [modified] Pin
moon_stick13-Oct-08 5:10
Membermoon_stick13-Oct-08 5:10 
AnswerRe: MS DTC has cancelled the transaction Pin
Wendelius13-Oct-08 5:50
mveWendelius13-Oct-08 5:50 
GeneralRe: MS DTC has cancelled the transaction [modified] Pin
moon_stick13-Oct-08 6:07
Membermoon_stick13-Oct-08 6:07 
GeneralRe: MS DTC has cancelled the transaction Pin
Wendelius13-Oct-08 7:20
mveWendelius13-Oct-08 7:20 
GeneralRe: MS DTC has cancelled the transaction Pin
moon_stick13-Oct-08 9:24
Membermoon_stick13-Oct-08 9:24 
GeneralRe: MS DTC has cancelled the transaction Pin
Wendelius13-Oct-08 9:35
mveWendelius13-Oct-08 9:35 
GeneralRe: MS DTC has cancelled the transaction Pin
moon_stick15-Oct-08 23:24
Membermoon_stick15-Oct-08 23:24 
GeneralRe: MS DTC has cancelled the transaction Pin
Wendelius16-Oct-08 8:42
mveWendelius16-Oct-08 8:42 
QuestionSql Pin
Rajeesrivastava12-Oct-08 21:25
MemberRajeesrivastava12-Oct-08 21:25 
AnswerRe: Sql - 3RD POST!!!!!!!!!!!!!!!!! Pin
Ashfield12-Oct-08 22:12
MemberAshfield12-Oct-08 22:12 
GeneralRe: Sql - 3RD POST!!!!!!!!!!!!!!!!! Pin
Paul Conrad13-Oct-08 12:51
professionalPaul Conrad13-Oct-08 12:51 
QuestionHow to solve the error "The query builder failed." Pin
kyi kyi12-Oct-08 21:23
Memberkyi kyi12-Oct-08 21:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.