Sunday, March 17, 2013

[T-SQL] Pivot Query with Count

[T-SQL] Pivot Query with Count


Pivot Query with Count

Posted: 17 Mar 2013 12:41 AM PDT

Hi thereI am fairly new to SQL Server TSQL and I have a strong MS Access background.I can't get my head around pivot queries is TSQL.I have 3 Colums with data in it:1) City2) Delivery_type3) Date_DeliveredI want to create a pivot query that has the format with 14 columns1) City (Grouped)2) Deliver (Grouped)3) Jan (Count the amount of dates for month of Jan)4) Feb (Count the amount of dates for month of Feb)...14) Dec (Count the amount of dates for month of Feb)If you can guide me in the right direction I will appreciate it, Thx

problem in select command

Posted: 16 Mar 2013 10:53 AM PDT

hi please look at this select command :[Code][b]select top 2 * from dbo.NFFeeds order by id desc [/b][/code]for my database the result is 2 rows .first by id=33 and second by id=32by this command i get two last rows from my table . how can i get this two rows like this :first row by id=32 and second row by id=33

No comments:

Post a Comment

Search This Blog