Click here to Skip to main content
15,909,373 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Server script to find table dependencies Pin
Mycroft Holmes13-Apr-12 12:54
professionalMycroft Holmes13-Apr-12 12:54 
Questioncan not get union recordset from two Sql Server2K store procedure Pin
Zhenjie Fu11-Apr-12 22:28
Zhenjie Fu11-Apr-12 22:28 
AnswerRe: can not get union recordset from two Sql Server2K store procedure Pin
Eddy Vluggen12-Apr-12 9:02
professionalEddy Vluggen12-Apr-12 9:02 
GeneralRe: can not get union recordset from two Sql Server2K store procedure Pin
Zhenjie Fu12-Apr-12 22:31
Zhenjie Fu12-Apr-12 22:31 
GeneralRe: can not get union recordset from two Sql Server2K store procedure Pin
Eddy Vluggen13-Apr-12 7:25
professionalEddy Vluggen13-Apr-12 7:25 
QuestionSQL Top n By Group Pin
Richard.Berry10011-Apr-12 16:47
Richard.Berry10011-Apr-12 16:47 
AnswerRe: SQL Top n By Group Pin
Corporal Agarn12-Apr-12 3:08
professionalCorporal Agarn12-Apr-12 3:08 
GeneralRe: SQL Top n By Group Pin
Richard.Berry10012-Apr-12 6:39
Richard.Berry10012-Apr-12 6:39 
Hi djj55

I tested the query and it did not return what I was expecting.

It only returned three rows.

I need the last three orders for every stock code.

Maybe I need to
SELECT DISTINCT (product) from opdetm 
or something like that?

And then do the joins to opheadm and join to get the last three orders?

There is another table (stockm) stock master which has product as a primary key, so I could use that as well, except I would also need to only select records from stockm where the warehouse = '06'

Currently I am pulling all stockm records where warehouse = '06' into another datatable in my application with a separate query, then I want to loop through the result set of this query and populate the table from stockm with the prices, dates and quantities of the last three sales orders, as well as comparing the standard cost of the item with the last sales order, and calculating the difference between the last Sales order and the standard cost

The end result is a grid showing ALL stock items in warehouse 06, with the following columns:

warehouse, product, physical_qty, standard_material, Error, SO1Price, SO1Date, SO1Qty, SO2Price, SO2Date, SO2Qty, SO3Price, SO3Date, SO3Qty

If an item in the stock master has no sales, it must be listed, but the all the SO fields must be blank.
GeneralRe: SQL Top n By Group Pin
Corporal Agarn12-Apr-12 6:50
professionalCorporal Agarn12-Apr-12 6:50 
GeneralRe: SQL Top n By Group Pin
Richard.Berry10012-Apr-12 7:10
Richard.Berry10012-Apr-12 7:10 
QuestionI have a problem in a SSIS solution !!! Pin
ma.amer11-Apr-12 2:30
ma.amer11-Apr-12 2:30 
AnswerRe: I have a problem in a SSIS solution !!! Pin
PIEBALDconsult11-Apr-12 3:15
mvePIEBALDconsult11-Apr-12 3:15 
GeneralRe: I have a problem in a SSIS solution !!! Pin
ma.amer11-Apr-12 3:24
ma.amer11-Apr-12 3:24 
GeneralRe: I have a problem in a SSIS solution !!! Pin
PIEBALDconsult11-Apr-12 14:38
mvePIEBALDconsult11-Apr-12 14:38 
GeneralRe: I have a problem in a SSIS solution !!! Pin
ma.amer24-Apr-12 13:02
ma.amer24-Apr-12 13:02 
GeneralRe: I have a problem in a SSIS solution !!! Pin
PIEBALDconsult24-Apr-12 13:29
mvePIEBALDconsult24-Apr-12 13:29 
AnswerRe: I have a problem in a SSIS solution !!! Pin
Mycroft Holmes11-Apr-12 12:50
professionalMycroft Holmes11-Apr-12 12:50 
GeneralRe: I have a problem in a SSIS solution !!! Pin
PIEBALDconsult11-Apr-12 14:39
mvePIEBALDconsult11-Apr-12 14:39 
QuestionWeird character conversion Pin
fd975010-Apr-12 22:21
professionalfd975010-Apr-12 22:21 
AnswerRe: Weird character conversion Pin
fd975011-Apr-12 2:19
professionalfd975011-Apr-12 2:19 
Newsconnection to database Pin
Micah David10-Apr-12 7:18
Micah David10-Apr-12 7:18 
GeneralRe: connection to database Pin
Richard MacCutchan10-Apr-12 8:33
mveRichard MacCutchan10-Apr-12 8:33 
QuestionNative paging on Sql Server Pin
SSEAR10-Apr-12 6:13
SSEAR10-Apr-12 6:13 
AnswerRe: Native paging on Sql Server Pin
jschell10-Apr-12 8:54
jschell10-Apr-12 8:54 
GeneralRe: Native paging on Sql Server Pin
SSEAR10-Apr-12 18:37
SSEAR10-Apr-12 18:37 

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.