Group Pricing Problem

RFigaro

Registered User.
Local time
Yesterday, 23:46
Joined
Aug 5, 2012
Messages
18
Group Pricing Problem
I am trying to create a query that will find all the records where the mark-up field is different than the rest per item. For example:
Item# Customer Mark-Up lineitemID
1-----------1---------1-------1
2-----------1---------1-------2
2-----------2---------2-------3
2-----------3---------1-------4
3-----------1---------3-------5
3-----------2---------3-------6
3-----------3---------3-------7

I would like for the query to return
Item# Customer Mark-Up lineitemID
2------------1---------1--------2
2------------2---------2--------3
2------------3---------1--------4
I am trying to manually edit the mark ups so all customers match for a specific item.

Thank you very much in advance for any help.

This is one of my first posts so please correct me if I have made any errors or omitted any needed information.
 
Last edited:
So you want to return all rows for an item where an item has varying markups?

You need to create two queries as below:

Query1:
SELECT ItemNo, Markup from products
group by ItemNo, Markup

Query2:
Select ItemNo, Count(*) as countOfItemNo from query1
group by itemno having count(*) > 1
 
Last edited:
Thank you for the advice I will give it a try!
 
I tried it and unfortunately the results did not match the needed results as shown above. The second query2 returned:
ItemNo. countofItemNo
2 -------------2
 
Okay, you need a third query then:
select * from products inner join query2 on products.itemno = query2.itemno
 
You are brilliant mssql thank you again. It worked like a charm.
 

Users who are viewing this thread

Back
Top Bottom