Quick SQL query
$10 USD
착불
Hi, I need some help to build a quick SQL query:
Given table A (
categ int,
prod varchar,
stock int )
I need to get for every categ the 3 pairs (prod, stock) with higher stock.
Example:
Given this table A contents:
categ prod stock
1 st1 65
2 st2 34
3 st3 21
1 st4 11
2 st5 99
3 st6 31
3 st7 12
2 st8 10
1 st9 9
2 st10 17
3 st11 23
1 st12 67
3 st13 87
2 st14 92
1 st15 3
The query should return:
categ prod stock
1 st12 67
1 st1 65
1 st4 11
2 st5 99
2 st14 92
2 st2 34
3 st13 87
3 st6 31
3 st11 23
Pure SQL to be used (DB: MySQL)
Thanks!
프로젝트 ID: #8322727
프로젝트 소개
이 일자리에 대한 프리랜서 32 명의 평균 입찰가: $13
will help you with this in a hour thank you Patzz . ...........................................................
Hi there - My name is Paris. I've read your brief and can see that you'd like to have some queries. I have 7 years’ experience designing and developing databases and dealing with SQL queries. I would approach your pro 기타
I am sql expert certified by Oracle corporation and having more then 5 yrs of experience in sql Oracle and mysql. I can give in few second
Very easy and straight forward work. Let me get it done quickly for you (within 5 minutes) I am available instantly.
Hello, I have been working with a MNC based company since last ~ 5 years, as an IT BI DWH Professional. The project is a BI DWH project which covers 3 layers of BI (ETL, Data warehouse & Reporting) and helped me in 기타
give me more details....................................................................... Waiting for your reply
select * from A order by cated desc this is the query you require. and please explain a bit if you think you didnt get desired results maybe I have not fully understood your requirement
Hello, I have been working on sql since 4yrs. I can write a query for this. Please award me this bid. Thanks
If this work, then pay me: Select top 3 pro, categ, stock from tableA group by stock order by stock desc Let me know if it works
More than 6 years of industry experience, understood your requirements and can easily do this query for you.
I have designed and developed more than 200 websites as of now. I have great expertise in Core PHP, Wordpress ,Laravel, Cake PHP, Javascript, Jquery,Ajax, Mysql, HTML,CSS, Webservices, Linux, Apache, 3rd party API’s 기타
Use this query: WITH B AS ( SELECT *, ROW_NUMBER() OVER (PARTITION BY categ ORDER BY categ ASC, stock DESC) AS rn FROM A ) SELECT categ, prod, stock FROM B WHERE rn <= 3 Thanks for reading my proposal.
HI. I will do this SQL query . I will do this on mysql database. I will do this now. can you talk to me now thanks
Sun, 23 Aug 2015 14:05:55 +0000 Could not get pure SQL. Care to elaborate? Can be done for MySQL W