How to make table(s) for categories and sub categories and how to call it


i have list of main categories , sub categories in going have repeater load main categories , sub categories within each main category.

don't know best way start sql. tried following:

table1 (maincategories)
maincatid (pk)
maincatname

table2 (subcategories)
subcatid (pk)
subcatname
maincatid (fk)


started idea , couldn't write stored procedure load data correctly, can let me know kind of process can do? thought of using 1 table main , sub categories wasn't sure how that.

in advance.

hi elbasha,

sean has pointed out table structure looks fine, nothing wrong in it.  thing add - result getting whatever query wrote fine , showing result expected to.

issue talking display issue, , guess should put question on forums of whatever front end application using.  sql not meant handling display issues.

of xml can subcats in comma separated format in single field, guess not want.


if creating report out of, advance reporting tools can fulfill requirement grouping report on main category column.

mangal pardeshi  
sql mangal


SQL Server  >  Getting started with SQL Server



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........