Click here to Skip to main content
15,919,749 members
Home / Discussions / Database
   

Database

 
AnswerRe: Connect to Oracle database from Log4net.config file Pin
Eddy Vluggen27-Apr-12 8:08
professionalEddy Vluggen27-Apr-12 8:08 
QuestionYour thoughts on Database Model - KPI System Pin
DaveAuld25-Apr-12 5:50
professionalDaveAuld25-Apr-12 5:50 
AnswerRe: Your thoughts on Database Model - KPI System Pin
Eddy Vluggen25-Apr-12 7:09
professionalEddy Vluggen25-Apr-12 7:09 
GeneralRe: Your thoughts on Database Model - KPI System Pin
DaveAuld6-May-12 1:38
professionalDaveAuld6-May-12 1:38 
AnswerRe: Your thoughts on Database Model - KPI System Pin
jschell25-Apr-12 8:16
jschell25-Apr-12 8:16 
GeneralRe: Your thoughts on Database Model - KPI System Pin
Jörgen Andersson26-Apr-12 1:38
professionalJörgen Andersson26-Apr-12 1:38 
GeneralRe: Your thoughts on Database Model - KPI System Pin
DaveAuld6-May-12 1:46
professionalDaveAuld6-May-12 1:46 
QuestionHow to create SQL Backup and Restore Server-based (.mdf) Database built in Visual Studio 2010? Pin
carm_ella24-Apr-12 0:20
carm_ella24-Apr-12 0:20 
AnswerRe: How to create SQL Backup and Restore Server-based (.mdf) Database built in Visual Studio 2010? Pin
kalaisw24-Apr-12 2:58
kalaisw24-Apr-12 2:58 
JokeRe: How to create SQL Backup and Restore Server-based (.mdf) Database built in Visual Studio 2010? Pin
Eddy Vluggen24-Apr-12 5:03
professionalEddy Vluggen24-Apr-12 5:03 
GeneralRe: How to create SQL Backup and Restore Server-based (.mdf) Database built in Visual Studio 2010? Pin
carm_ella12-May-12 23:39
carm_ella12-May-12 23:39 
AnswerRe: How to create SQL Backup and Restore Server-based (.mdf) Database built in Visual Studio 2010? Pin
Eddy Vluggen13-May-12 4:20
professionalEddy Vluggen13-May-12 4:20 
QuestionI can not drop table after upgrading to sql 2008 r2 from sql 2005 Pin
yousefshokati22-Apr-12 21:31
yousefshokati22-Apr-12 21:31 
AnswerRe: I can not drop table after upgrading to sql 2008 r2 from sql 2005 Pin
Pete O'Hanlon23-Apr-12 0:54
mvePete O'Hanlon23-Apr-12 0:54 
GeneralRe: I can not drop table after upgrading to sql 2008 r2 from sql 2005 Pin
yousefshokati23-Apr-12 1:02
yousefshokati23-Apr-12 1:02 
GeneralRe: I can not drop table after upgrading to sql 2008 r2 from sql 2005 Pin
Pete O'Hanlon23-Apr-12 1:13
mvePete O'Hanlon23-Apr-12 1:13 
QuestionSQL 2008 to SQL2005 Pin
jojoba201122-Apr-12 21:25
jojoba201122-Apr-12 21:25 
AnswerRe: SQL 2008 to SQL2005 Pin
Blue_Boy22-Apr-12 21:43
Blue_Boy22-Apr-12 21:43 
QuestionRe: SQL 2008 to SQL2005 Pin
jojoba201122-Apr-12 22:02
jojoba201122-Apr-12 22:02 
AnswerRe: SQL 2008 to SQL2005 Pin
Mycroft Holmes22-Apr-12 22:46
professionalMycroft Holmes22-Apr-12 22:46 
AnswerRe: SQL 2008 to SQL2005 Pin
Eddy Vluggen23-Apr-12 0:20
professionalEddy Vluggen23-Apr-12 0:20 
QuestionRe: SQL 2008 to SQL2005 Pin
jojoba201122-Apr-12 23:10
jojoba201122-Apr-12 23:10 
QuestionSQL Get Max for each group Pin
Richard.Berry10020-Apr-12 11:52
Richard.Berry10020-Apr-12 11:52 
AnswerRe: SQL Get Max for each group Pin
Mycroft Holmes20-Apr-12 13:40
professionalMycroft Holmes20-Apr-12 13:40 
GeneralRe: SQL Get Max for each group Pin
Richard.Berry10020-Apr-12 20:51
Richard.Berry10020-Apr-12 20:51 
Thanks Mycroft, but I have no idea how to do this.

First, I'm not sure how to put in the PARTITION clause,
Second, the Despatch date is in the header table (opheadm), with a Sales Order Num, but I want to Partition by Product not by Sales Order Num, and the product is in the Details Table (opdetm).

This what I have tried so far, but I get an error "The column 'order_no' was specified multiple times for ordlist

SELECT opdetm.warehouse, opdetm.product, opdetm.net_price, opdetm.despatched_qty, opheadm.date_despatched 
FROM vektron.scheme.opdetm INNER JOIN vektron.scheme.opheadm ON opdetm.order_no = opheadm.order_no ,
(SELECT ROW_NUMBER() OVER (PARTITION BY opheadm.order_num ORDER BY date_entered DESC) , *  FROM vektron.scheme.opheadm inner join vektron.scheme.opdetm on opdetm.order_no = opheadm.order_no) as ordlist
WHERE(((opheadm.status) = '8') And ((opdetm.warehouse) = '06') And ((opdetm.net_price) > 0) And ((opdetm.despatched_qty) > 0)) and ordlist.order_no = 1 and opdetm.product = ordlist.product
ORDER BY opdetm.product, opheadm.date_despatched DESC

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.