Advertisement

03.26.2007 at 08:49AM PDT, ID: 22472681
[x]
Attachment Details

SQL query to pull values from highest sequence

Asked by tgfo62 in MS SQL Server

I have a report I am building in BI studio pulling data from a SQL server.  This is puzzling to me, but I'm sure I can write a sql statement to accomplish what I need.  

I have an order - say 92857 which has 4 depts it goes through in the plant 10, 20, 30, 40
each dept gives a total parts when it is finished - 10 - 1500, 20 - 1450, 30- 1250, 40 - 0
I need to take the last sequence number that isn't zero (in this case 30 - 1250) and put that figure into another box on the report for a comparison to another field that is pulled from somewhere else.  If I sum it - it gives me a total of the 10, 20, 30, 40.  Can a sql statement do this saying basically if 40 = 0 then put the amount of 30 in the box, or if 40=0 and 30=0 then put the 20 amount in the box - you get what i'm saying?
Start Free Trial
 
 
Loading Advertisement...
 
[+][-]03.26.2007 at 09:07AM PDT, ID: 18793822

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.26.2007 at 10:17AM PDT, ID: 18794379

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.26.2007 at 10:44AM PDT, ID: 18794563

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.27.2007 at 12:52AM PDT, ID: 18798395

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2007 at 07:59AM PDT, ID: 18800401

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.27.2007 at 10:14AM PDT, ID: 18801546

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2007 at 11:43AM PDT, ID: 18802403

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.03.2007 at 09:46AM PDT, ID: 18844793

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Sign Up Now!
Solution Provided By: jogos
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.04.2007 at 09:20AM PDT, ID: 18851733

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.04.2007 at 09:43AM PDT, ID: 18851888

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 04:52AM PDT, ID: 21854630

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]06.24.2008 at 08:29AM PDT, ID: 21856811

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.28.2008 at 04:43AM PDT, ID: 21890349

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32