SQL Power Business Intelligence Productivity Tools
Company OverviewBusiness Intelligence Productivity ToolsQuick-Start Implementation ServicesDemos & TurotialsFrequently Asked Questions (FAQ)Open Source Community ResourcesSQL Power ForumImplementation & Technology PartnersGet SQL Power SoftwareContact Us

SQL Power Software Forum

SQL Power Software Forum

  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page  [Register] Register /  [Login] Login 
Add a new field to table  XML
Forum Index » SQL Power DQguru Suggestions
Author Message
jafrywilson


Joined: 2010-08-25 02:34:43
Messages: 1
Offline

select t1.*,t2.Product_Name from
(
select mobid,
max(case when seq=1 then merchant else null end) as min_merchant,
max(case when seq=1 then price else null end) as min_price,
max(case when bseq=1 then merchant else null end) as max_merchant,
max(case when bseq=1 then price else null end) as max_price
from
(
select row_number() over (partition by mobid order by price) as seq,row_number() over (partition by mobid order by price desc) as bseq,mobid, merchant,price
from tbl_merchant
t
where (seq=1 or bseq=1) and mobid in(select MOBID from tbl_product where Client_Name='wilson')


group by mobid
as t1 INNER JOIN tbl_product as t2 on t2.mobid=t1.mobid

In the above query i need to add my_Price field where
my_price is where my name matches for that product




 
Forum Index » SQL Power DQguru Suggestions
Go to:   
Powered by JForum 2.1.8 © JForum Team