June 28, 2013 at 12:05 am
hi friends i have small doubt in sql server plese tell me how to solve this issuse
table data contains like
pidpdate price
12013-02-10100
12013-03-11100
12013-04-14100
22013-04-10100
22013-08-04100
32013-05-24100
12013-07-05100
22013-04-05500
22013-04-01200
22013-06-02200
based on this i want display max prodcut id sales details
actualy i tryied like this way
select pid,COUNT(pid)as b from product group by pid having max(pid)=1
but its not give exactely result.plz tell me query how to solve this isuse in sql server.
June 28, 2013 at 12:43 am
Can u provide the sample output which u need?
June 28, 2013 at 4:37 am
Can you please explain little more what kind of output you want?
its not clear.
June 28, 2013 at 7:55 am
In order to help we will need a few things:
1. Sample DDL in the form of CREATE TABLE statements
2. Sample data in the form of INSERT INTO statements
3. Expected results based on the sample data
I posted a nice example of how to post this stuff in your other thread. This is a great opportunity for you to do it this time. 🙂
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply