Problem With Category Grouping In SSRS

Apr 3, 2008

I have an SSRS chart which has 4 to 5 levels of categories (for eg- Country,State,City,Street) levels , Now when i select the street it shows groups starting from Country then State, City, and then street . Because of these grouping sometimes the label is not appearing properly its gets truncated between lines , Is there any way to avoid showing the groups only show the last group for example as per the above example (Instead of showing State, City, and then street ) just show the Street itself so that all grouping lines get avoided and chart looks better without any label truncation

View 8 Replies


ADVERTISEMENT

Reporting Services :: SSRS Sparkline Category With Lookup

Oct 20, 2015

I have a table in which I have to use SSRS Sparklines. But the requirement is that, I have to lookup the Y axis values and Category groups from another dataset, using a unique identifier in both the datasets. Lets say DS1 is the parent dataset and DS2 has got the Y values and Category (12 months) for the Sparkline.I cannot use DS2 as Default dataset for the table, because it will result in writing lookup expressions for around 20-25 cells other than Sparkline cell.So I used the below expressions for Sparkline.

Value axis : 
=lookupset(Fields!RowID.Value,Fields!RowID.Value,Fields!Trend.Value,"DS2")
Category axis : 
=lookupset(Fields!RowID.Value,Fields!RowID.Value,Fields!MonthName.Value,"DS2")

I used lookup set, because I believe we have to map a set of values to the Sparkline chart.  But it throws me the below error. Is it possible to configure a Sparkline without Category axis? I asked because I can manage my chart if SParkline can plot the trend values alone, without a category axis also.

View 4 Replies View Related

Category/Parent Category Design And Querying

Jun 29, 2005

Hi,

I have a simple table:

Categories
----------
CategoryID
ParentID
Name

I want to associate my Products to a category so that I can search by category....ok.  If I just have a simlpe table:

CategoryProducts
-------------------
CategoryId
ProductId

I can link a product to a category.  Now, if I just link a product to a single category, such as the bottom leaf category:

Self Help / Personal Development / Spiritual / Meditation

I would link a product to the Meditation category.  However if I
click on Self Help while browsing, I want to see all items underneath
Personal Development, Spiritual and Meditiation.  So my question
is is this a good way to store the product-category relationships, or
should I put many entries into CategoryProducts to keep the queries
simlpe and faster? Are they faster doing it this way? In this way there
would be 4 entries for a product in meditation.  My personal idea
is that adding all entries up a tree arm of a category path will be
cumbersome to manage, but it does solve the problem of clicking on Self
Help and seeing all products that exist within sub-categories.  I
am sure an SQL query would be able to work this out, but I dont know if
performance would be something to consider on an ecommerce site? Are
there any patterns fo rthis stuff - seems a reasonably repeatable
pattern for business sites?

Thanks,

jr.

View 5 Replies View Related

Grouping In Ssrs

Apr 26, 2008

SSRS Report using letter and detail are grouped two table ,but output taken all Customer letter and all customer detail
Display .Grouping with Payee is not coming.It is taking as a individual. finally i've tried with Sub Report. this is
also same output Display, individual letter and detail will be Display proper I Want one by one letter,detail report for all record ?

View 3 Replies View Related

Grouping In SSRS

Oct 29, 2007

I am a complete newbie in SSRS. I've worked for several years with Crystal Reports. I created a Crystal report which lists detail information for each General Ledger Account. I want to group the report by the first 10 characters of the account, list all the accounts in that group, and then page break for a new group. The report should look like this:


2-999-9999

2-999-9999-1234

Transaction Number Date Amount Remarks

1111 10/1/2007 300.00 JE999
2222 10/2/2007 200.00 JE59


2-999-9999-5678

Transaction Number Date Amount Remarks

1212 10/5/2007 600.00 PY92


I think I must be missing something very simple, but I can't seem to do this in SSRS.

Can anyone help?

Thanks very much.

Sue

View 8 Replies View Related

Totals && Grouping In SSRS 2005

May 1, 2008

I think this is a simple question for creating a report with SQL Reporting Services, but I can't seem to find any straight forward answers for this.

I have some detail data I'm pulling in from 1 view into my report dataset:
------------------------------------------------------
Loan NumberLoan AmountPayment DatePayment
1000550000Jan 200815000
1000550000Feb 200815000
1000550000Mar 200815000
1002300000Jan 200850000
1003450000Jan 200820000
1003450000Feb 200820000
------------------------------------------------------
I'm creating a RDL with this data and in my detail row, I'm showing the Loan Pmt and Loan Date with Grouping on the Loan Number & Loan Amount.

My problem is that when I look at my grand total, it is summing up the Loan amount more than 1 time - once for each detail record.
------------------------------------------------------
RDL
Loan Number Loan Amount Payment Date Payment
1000 550000 Jan 2008 15000
Feb 2008 15000
Mar 2008 15000
Subtotal 45000
Loan Balance505000

1002 300000 Jan 2008 50000
Subtotal 50000
Loan Balance250000

1003 450000 Jan 2008 20000
Feb 2008 20000
Subtotal 40000
Loan Balance410000

Grand Totals 2850000 135000
------------------------------------------------------

So my total on the Loan Amount column is incorrect, it should really be 1,300,000, but instead it's calculating 2,850,000.

Can someone explain to me how I should correct my grouping or dataset in a table?

I was able to use a Subreport for my detail records, and keep the Loan details in my Parent report to get the right totals, but then I hit the issue with exporting to Excel - "Subreports within table/matrix cells are ignored"

Any suggestions??

View 2 Replies View Related

Grouping ON A Table In SSRS 2005

Oct 15, 2007

I have a table that will always return 6 records. I would like to group the table, such that the first 3 records, are GROUPED Together first, do the sub-total on these 3 records first. Then the last 3 records are grouped together. and then the sub-total on the last 3 records. Is there a way I can do that in SSRS 2005?

View 3 Replies View Related

Reporting Services :: SSRS Grouping And Page Break

Mar 5, 2014

Example: A sales report that details and summarizes each Salesperson’s total sales within a company’s stores that reside in each state. 

The report has 3 levels of groupings where the highest 2 levels require summary counts on a separate page and the lowest level produces a summary count in the midst of the detail lines of the report.

The data consumed by the report is ordered by State, Store ID, and Salesperson. 

The header of each page lists the State and Store ID.  The detail lines of the report list items sold and the associated sales amount for each item sold by each store’s salesperson. 

At the end of each Salesperson’s items sold, a summary line is listed on the next line in the report showing the total amount and total count of items sold by that Salesperson. 

The very next line on the report lists items sold and the associated sales amount for the next Salesperson within that particular store. 

Summary lines will be produced for each Salesperson within each particular store on the next line of detail in the report.

At the end of all sales data for each store, a summary page is produced on a separate page listing the summary of each Salesperson’s totals. 

Each line of the summary page contains the same counts for each Salesperson that was embedded in the detail section of the report. 

The summary page also contains a grand total line listing the total count and sales for all salesmen within each given store.

At the end of all sales data for each state a summary page is produced on a separate page listing the summary of each store’s totals. 

Each line of the summary page contains the grand totals of all sales for each store within a given state. 

The summary page also contains a grand total line listing the total count and sales for all stores within each given state.

The simple breakdown is the groupings and totals for each state and store must be listed on a separate page in the report. 

The grouping and totals for each Salesperson must be listed on the next line within the detail section of the report. 

Current issue: The requirement is for no page break at the end of each salesperson’s sales data because the page breaks produce too many extra pages in the report. 

Disabling the page break at the Salesperson level produces format issues such as page headers printing on the next line in the report before each Salesperson’s summary line. 

Disabling the page breaks at this level also produces the problem of suppressing the page break for the summary page that comes at the end of each store.

Question:The report has 3 levels of grouping with Salesperson at the lowest level, Store ID being the parent group of Salesperson, and State being the parent group of Store ID.  Is it possible to format the Salesperson summary line (lowest level grouping) as just another detail line in the report without impacting the report format that requires page breaks at the parent group levels?

A sample report layout of what we are trying to achieve is on the next page.
 
Sales Report
State: Alaska                         
Store ID: 100

Item Sold               
Sales Amount
Hammer                
$10.00
Saw                        
$15.00

[Code] .....

View 2 Replies View Related

Reporting Services :: Ranking For Row Grouping In SSRS Report

Apr 28, 2015

I want to display data in following format in ssrs report. 

Rank Group  Value
1        G1      10
2        G1      20
3        G1      30
4        G1      40
1        G2      25
2        G2      54
3        G2      64

I tried row count and other ranking functions but it did not working.

View 3 Replies View Related

Reporting Services :: Develop SSRS Report Based On Grouping Of Certain Columns

Sep 1, 2015

I want to develop a ssrs report which is grouped by month?

View 4 Replies View Related

Reporting Services :: SSRS 2012 - Page Break With Column Grouping

Nov 16, 2015

We are facing problem in doing page break with column grouping. Our column group contains years e.g 2011, 2013 . We want to show a complete page for a year. 

Suppose 2011 has 10 records(horizontal) and 2013 has 12 records(horizontal) in column. The output should be 10 records of 2011 in first page, 12 records of 2013 in second page.

We cannot change the report layout to make column to row and vice versa.

View 3 Replies View Related

Reporting Services :: SSRS 2008 R2 / Grouping Multiple Tables (tablix) With Different Datasets

Mar 27, 2012

We have a report that was created in SSRS 2008 R2 that has 3 tables with different datasets that share a common ID that I want to use to group them.

If we run the report passing only a single value for the grouped parameter then the report works perfectly.  What we need is for this report to allow multiple values to be selected for this parameter and for the report to run as if the user had selected each value one at a time and run the report with page breaks in between.  Currently, when we pass multiple selected values for the grouping parameter the report displays all values for table 1, then all values for table 2, then all values for table three as below:

Table 1:

Detail rows for Group Param Value 1 ...
Detail rows for Group Param Value 2 ...
Detail rows for Group Param Value 3 ...
....

Table 3:

Detail rows for Group Param Value 1 ...
Detail rows for Group Param Value 2 ...
Detail rows for Group Param Value 3 ...

But we want it to render like this:

Table 1:
Detail rows for Group Param Value 1...
Table 2:
Detail rows for Group Param Value 1...
Table 3:
Detail rows for Group Param Value 1...

[code]....

The page breaks are needed so that when the report is exported to excel each individual report (by group param) will be on its own uniquely named tab.The report must export cleanly to excel and currently does for the single value passed.

View 5 Replies View Related

Reporting Services :: Grouping A Table Inside A Table Cell - SSRS Report

Jun 10, 2015

I have a report where in I want to show each record on a separate page.

So, to achieve that I took a single cell from table control, expanded it and used all the controls in that single cell. This looks nice so far.

Now, I also have to show a  sub grid on each record. So I took a table control and added on the same single cell and tried to add a parent group to the table row.

When I preview, it throws this error.

"The tablix has a detail member with inner members. Detail members can only contain static inner members."

What am I doing wrong? How can I achieve table grouping inside a table cell?

View 2 Replies View Related

Looping Through Stored Procedure Inside Another Stored Procedure And Displaying The Category And Then Displaying 1 Item In Each Category

Sep 21, 2006

I used to do this with classic asp but I'm not sure how to do it with .net.Basically I would take a table of Categories, Then I would loop through those.  Within each loop I would call another stored procedure to get each item in that Category. I'll try to explain, Lets say category 2 has a player Reggie Bush and a player Drew Brees, and category 5 has Michael Vick, but the other categories have no items.Just for an example.. Category Table: ID   Category1      Saints2      Falcons3      Bucaneers4      Chargers5      FalconsPlayer Table:ID    CategoryID   Player                 News                                Player Last Updated1            1           Reggie Bush       Poetry in motion                                9/21/20062            1           Drew Brees         What shoulder injury?                        9/18/20063            5           Michael Vick       Break a leg, seriously.                       9/20/2006 Basically I would need to display on a page:SaintsReggie BushPoetry in MotionFalconsMichael VickBreak a leg, seriously.So that the Drew Brees update doesnt display, only the Reggie Bush one, which is the latest.I have my stored procedures put together to do this.  I just don't know how to loop through and display it on a page.  Right now I have two datareaders in the code behind but ideally something like this, I would think the code  would go on the page itself, around the html.

View 1 Replies View Related

Grouping By One Field And Combine Data Of Another Field In SSRS

Apr 2, 2008

Hi all experters,

Please suggest how to build the report in below case:

Raw data:






ID
Member
Functions

1
Alan
A

1
Alan
B

2
Tom
A

2
Tom
B

2
Tom
C

3
Mary
D

3
Mary
E


Report Shows:






ID
Member
Functions

1
Alan
A,B

2
Tom
A,B,C

3
Mary
D,E


I group the data by the column ID, but would like to show the functions data by join all functions' values by the same ID.

Any good suggestion?

Thanks in advance,
Steve Wang
2008/4/2

View 6 Replies View Related

Query Or Grouping Problem (some Kind Of Parallel Grouping?)

Nov 26, 2007

I'm really stumped on this one. I'm a self taught SQL guy, so there is probobly something I'm overlooking.

I'm trying to get information like this in to a report:

WO#
-WO Line #
--(Details)
--Work Order Line Detail #1
--Work Order Line Detail #2
--Work Order Line Detail #3
--Work Order Line Detail #etc
--(Parts)
--Work Order Line Parts #1
--Work Order Line Parts #2
--Work Order Line Detail #etc
WO#
-WO Line #
--(Details)
--Work Order Line Detail #1
--Work Order Line Detail #2
--Work Order Line Detail #3
--Work Order Line Detail #etc
--(Parts)
--Work Order Line Parts #1
--Work Order Line Parts #2
--Work Order Line Parts #etc

I'm unable to get the grouping right on this. Since the line details and line parts both are children of the line #, how do you do "parallel groups"?

There are 4 tables:

Work Order Header
Work Order Line
Work Order Line Details
Work Order Line Requisitions

The Header has a unique PK.
The Line uses the Header and a Line # as foreign keys that together are unique.
The Detail and requisition tables use the header and line #'s in addition to their own line number foreign keys. My queries ends up looking like this:

WO WOL WOLR WOLD
226952 10000 10000 10000
226952 10000 10000 20000
226952 10000 10000 30000
226952 10000 10000 40000
226952 10000 20000 10000
226952 10000 20000 20000
226952 10000 20000 30000
226952 10000 20000 40000
399999 10000 NULL 10000
375654 10000 10000 NULL
etc


Hierarchy:
WO > WOL > WOLD
WO > WOL > WOLR

It probobly isn't best practice, but I'm kinda new so I need some guidance. I'd really appreciate any help! Here's my query:

SELECT [Work Order Header].No_ AS WO_No, [Work Order Line].[Line No_] AS WOL_No,
[Work Order Requisition].[Line No_] AS WOLR_No, [Work Order Line Detail].[Line No_] AS WOLD_No
FROM [Work Order Header] LEFT OUTER JOIN
[Work Order Line] ON [Work Order Header].No_ = [Work Order Line].[Work Order No_] LEFT OUTER JOIN
[Work Order Line Detail] ON [Work Order Line].[Work Order No_] = [Work Order Line Detail].[Work Order No_] AND
[Work Order Line].[Line No_] = [Work Order Line Detail].[Work Order Line No_] LEFT OUTER JOIN
[Work Order Requisition] ON [Work Order Line].[Work Order No_] = [Work Order Requisition].[Work Order No_] AND
[Work Order Line].[Line No_] = [Work Order Requisition].[Work Order Line No_]

View 1 Replies View Related

TOP N Value Per Category

Oct 26, 2006

HelloI am using sql server 2005.I have two tables as described below.Table1UserID UserSales---------------------1 102 133 174 195 216 107 128 119 3110 2311 2412 1013 16Table2UserID Country----------------------1 Canada2 Canada3 Canada4 Canada5 Canada6 USA7 USA8 USA9 USA10 USA11 UK12 UK13 UKI want to get top 2 UserSales for each country and remaining should bedisplayed as Total as Others for that country.Can someone please help me with this query?RegardsAmit

View 1 Replies View Related

Breakdown By Category

Dec 22, 2005

Let's say you a 1000 records in the Employees table, who are spread over 40 different cities.
How would you get a breakdown of how many employees in each city ?

Do I have to loop with  a  Count(*)   for each CityID, or something ?

There must be a more straightforward method.

View 1 Replies View Related

Top 3 For Every Category With Group By

Mar 6, 2006

hi.

I have a table to store salesman's performance..

as you can see at structure.jpg, Tom sold total 18 Processors (5 different modals) and sold 11 mainboards (4 different modals)

I want to report that
what are the TOP 3 Processor and Mainboard modals that Tom sold with the same query

I tried different group by methods. also subqueries.
I could't do

you see the results I need at result.jpg

View 1 Replies View Related

HAVING (COUNT(category) &> 1) , Not Only 1 Row

Sep 25, 2006

i am using this code :

SELECT MAX(user) AS lastuser, category
FROM journal
GROUP BY category
HAVING (COUNT(category) > 1)

it works but returns 1 line by category >1

i need all the user (all the rows) HAVING (COUNT(category) > 1) , not only 1

if 1 category has only 1 user i must not keep it


i am not shure to be clear :-)

thank you for helping

View 8 Replies View Related

Category Tables

Feb 25, 2004

What are the thoughts on using a categoy table? What I mean by this is to have a table used to hold simply a category identifier for other table(s).

Eg:

Hardware Table
Hadware (PK) | Category (FK) | Description | Finish | etc....
------------------------------------------------------------------------------
P1 | Plate | 4"x4"x1/4 plate | Painted |

HardwareCategories
Category (PK)
-----------------
Plate
Channel
Angle


Should this be done or simply provide a category field in the hardware table? I like the extra table because it kind of ensures that a user doens't add a plate with a category value "Plate", another user adds "plate", and another user adds "Plates", etc....

What are your thoughts if any?

Mike B

View 1 Replies View Related

Update Sys Category

Jan 27, 2008

I'm trying to remove a read only/stand by database that I believe was a messed-up attempt at log shipping. When I go through the interface it says 'cannot remove database because it is set up for replication'. If I try and 'directly update' the sys tables (yea I know you can't do that anymore) I get the error:


Msg 259, Level 16, State 1, Line 1

Ad hoc updates to system catalogs are not allowed.



So my dilema is I just want to delete a database that was attempting to do log shippinig and is now stuck in read only/standby. How can this be done in SQL 2005?

Thanks,
Phil

View 18 Replies View Related

Trying To Select Newest Row For Each Category...

Feb 6, 2004

Hi everyone -

I am building from the Time Tracker Start Kit, trying to get a better feel for how MS thinks we should do things.

In my editing, I have built a new Stored Procedure, trying to pull the newest entries for a specified person.

I have the following that will return all entries for a specific person, sorted by date, newest first:


SELECT
EntryLogID, TT_EntryLog.Description, Duration, EntryDate, TT_EntryLog.ProjectID AS ProjectID,
TT_EntryLog.CategoryID AS CategoryID, TT_Categories.Abbreviation AS CategoryName, TT_Projects.Name AS ProjectName,
ManagerUserID, TT_Categories.Abbreviation AS CatShortName
FROM
TT_EntryLog
INNER JOIN
TT_Categories
ON
TT_EntryLog.CategoryID = TT_Categories.CategoryID
INNER JOIN
TT_Projects
ON
TT_EntryLog.ProjectID = TT_Projects.ProjectID
WHERE
UserID = @UserID
ORDER BY
EntryDate Desc


This will return something like:


EntryLogId Description Duration EntryDate ProjectID CategoryID CategoryName ProjectName ManagerUserID CatShortName
14Can type date in date... .00 2004-02-04 10:28:00116Pros ITS Project Management App 3 Pros
12Changed "Entry Date"... .00 2004-02-03 13:28:00116Pros ITS Project Management App 3 Pros
13Added default button ... .00 2004-02-03 00:00:00116Pros ITS Project Management App 3 Pros
11Removed hours per p... .00 2004-02-03 00:00:00116Pros ITS Project Management App 3 Pros
6Isn't this cool .00 2004-02-02 00:00:00229Pros Knowledge Base 3 Pros
9Added week-by-week... .00 2004-02-02 00:00:00116Pros ITS Project Management App 3 Pros
10Fixed Update comma... .00 2004-02-02 00:00:00116Pros ITS Project Management App 3 Pros
1Built initial framewor... 6.00 2004-01-30 00:00:00116Pros ITS Project Management App 3 Pros
5Adding up to 8 hours... 2.00 2004-01-30 00:00:00229Pros Knowledge Base 3 Pros
3Debugged - fixed a f... 1.00 2004-01-23 00:00:00229Pros Knowledge Base 3 Pros



What I would like to accomplish is to return only the newest entry for each ProjectID (so in the above example, there would only be 2 entries, EntryID 14 and 6)

Any ideas?

Thanks in advance-

View 4 Replies View Related

Select Last Entry Per Category?

Nov 8, 2005

Hello,

I am trying to select the last entry (by date) for each category in a table.

For example, if my table had the following fields;

id, category, product, datePosted,....

...how would I select the last product for each category posted by date?

Any guidance is appreciated.

Thanks,
AC

Probably a simple solution, but can't find it my brain right now!

View 7 Replies View Related

Running Sum - How To Get It To Restart For Each Category

Jun 6, 2012

I was able to get a running some to work, but i cant seem to get it to restart for each category... for example this is what I have...

ID Name Return Run. Sum
1 aaa 0.1 0.1
2 aaa 0.2 0.3
3 aaa 0.3 0.6
4 aaa 0.1 0.7
5 bbb 0.5 1.2
6 bbb 0.4 1.6
7 bbb 0.1 1.7
8 bbb 0.3 2
9 bbb 0.2 2.2

How do i get it to start over at bbb??? Here is the code in access 2010:

Format(1000+(DSum("Return","Monthly Performance Dates","[ID]<=" & [ID] & "")*1000),"00.00")

View 1 Replies View Related

Query To Count AGE By Category

Sep 17, 2013

How to write a query to count AGE by category (Exec or non Exec)

sample are as follow:

----Age Group---------
Category: Age <25 age 25-35 age 45-50 Total
Exec 2 1 3
Non Exec 10 5 5 20

Grand total: 23

View 2 Replies View Related

10 Random Records, 1 From Each Category

Dec 1, 2006

I'm not sure if this is a completely dumb question, but please humor me:) I have a table of records, called Records, each of which has aCategory_ID that places it in a specific category; the details of thecategories are stored in another table called Category. What I need todo is retrieve a recordset that contains one record from each category,but where the records that are retrieved are random. I know how toretrieve one or more random records using "order by NewID()", but havenot been able to work out how to get one random record from eachcategory.Any assistance in this puzzler will be HUGELY appreciated!ThanksFEB

View 7 Replies View Related

Select Records Under Sub Category

Aug 30, 2007

I got 3 table below

Region
---------------
RegionID
ParentID
RegionName

Cuisine
--------
CuisineID
CuisineName

Restaurant
-----------
RetaurantID
CuisineID
RegionID

Data

RegionID RegionName ParentID
1 RN_1 Null
2 RN_2 Null
3 RN_1_1 1
4 RN_1_2 1
5 RN_2_1 2

CuisineID CuisineName
1 CU1
2 CU2

RestaurantID CuisineID RegionID
1 1 4
2 1 2
3 2 5
4 1 3


What I would like is to write a stored procedure to browse the restaurant by either regionname or cuisinename.
I tried to create the view from those three table and create the stored procedure to search from the view based on criterias
I tried to search for regionName = RN_1 & CuisineName = 2 the result is empty. It is true because there is no restaurant under that region however what I want to have is list all restaurants under that RegionName children e.g
RN_1 has RN_1_1 & RN_1_2 & RN_1_3 so the result should be displayed as

RestaurantID CuisineID RegionName ParentID
1 1 RN_1_2 1
4 2 RN_1_1 1

Could anyone help me to do so. Thank you

View 2 Replies View Related

Category Column In Sysobjects

Jul 25, 2007

Everyone,



Is there a reference to describe the relevance of the Category column in the sysobjects table? I'm trying to track down stored procedures that are set to automatically run at startup and the only thing I can find that is consistent about those that are set to autorun is that they have a value of 16 in the Category column. Is this consistent? What else may I glean from this column?



Thanks

Tim

View 3 Replies View Related

Need Category Table Implementation Help

Apr 20, 2008

Hi

I new to sql procedures and I need your advice on below subject. Thanks in advance.

I have products table that has catid (string 50) and subcatid (string 50) I like to transfer the string to another table (categories) and keep only int values in products catid and subcatid.

therefore I created categories table and added 3 fields;

catid int (primary and autonumber)
catname string 50 will be equal to category name in products table
parentid int (if it is a parent category, it will be equal to 0 otherwise if it is a subcategory it will be equal to parentcatid)

so instead writing a vb program I like to ask your advice on better solutions.

please help

Also I am using sql express 2005 and I wanted to practice (learn) sql DTS. is there any way I can download this package and work it with my system?

thanks again
Cemal

View 5 Replies View Related

Transact SQL :: How To Get Top 5 Based On A Category

Jun 4, 2015

I have this following query,

select [Parent Name],[ID],[Year],[Sales Name],
sum([Total VtM]) as 'Total Sales'
from RegData
group by [Parent Name],[ID],[Year],[Sales Name]
order by [Total Sales] desc

I need to modify this query to get the top 5 of each category based on Total Sales amount.

View 13 Replies View Related

SELECT CategoryID FROM Category WHERE Name Like %’@Name’%

Mar 16, 2007

Note:Codes
with in [] are optional u need not to read

 

I
am getting Incorrect syntax near '@Name'.

 

 

[

Dim strSQL As String

        Dim
param As New
SqlParameter

        Dim
AdaCategory As New
SqlDataAdapter

        Dim cmd as New SqlCommand()

 

]

 

 

 

strSQL = " SELECT CategoryID  FROM Category   WHERE Name
like %@Name%"

 

 

I
am getting Incorrect syntax near '@Name'.

 

I
also tried

 

strSQL = " SELECT CategoryID  FROM Category   WHERE Name
like %’@Name’%"

 

 

still Error :(

 

 

 

 

 

 

 

 

 

 

 

 

 

 [  cmd.CommandText = strSQL

param =
cmd.Parameters.Add("@Name",
SqlDbType.NVarChar)

            param.Value = catId

            cmd.CommandText = strSQL

           
AdaCategory.SelectCommand = cmd

 

AdaCategory.Fill(DTable)

 

]

 

 

 

 

Help me please……….

 

 

 

View 2 Replies View Related

How Can I Store More Than One Category In A Products Table?

Apr 16, 2007

How can I store more than one category in a products table?
For exampe: I have a dvd website where the admin can add new dvd's. On the website all the categories are listed with a checkbox. If the dvd is a action comedy the admin have to check these two checkboxes. But how do I store that in the sql database an retrieve it?
 Thanks
David

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved