Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have sales orders with quotes against them however new quote revisions are made and sometimes the sales orders don't get updated. So i need to write query to find any orders that don't have the most updated quote.

Currently this is done in excel but i want to be able to run a query to get the same results.

MY SQL or SQL Server.

Table and fields
Sales order lines - sales order ID / current quote ID
Quotes - Quote ID

The sales order ID is a numerical field XXXXX. The quote ID fields are like 12345 and if a new revision is created it a new quote is added and called 12345-A it goes up alphabetically per revision.

What i want to see is

Sales order ID | Current Quote ID | Latest Quote ID
---------------|------------------|-----------------
53849          | 12345            | 12345-D

Please let me know if this is possible

Example Data

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
145 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is too long for a comment and is not an answer.

I am totally baffled by the question. Your sample results have something called a Sales Order ID with a value of 53849. I see no 53849 in the sample data. Of course, I might be missing it. But I can't search an image.

Then:

The quote ID fields are like 12345.

However, none of the values in the Quote ID field look like this.

The first four columns are not labelled, so you have not communicated what the data looks like or how to identify the "old" and "new" values.

I would recommend that you ask a new question, with clear sample data as a text table (and also a fiddle is very helpful). And clear desired results.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...