.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

Sql query for hiding products which r in inactive groups

Posted By: jyothi     Posted Date: April 13, 2011    Points:5   Category :Sql Server
Hi all,

My requirement is . I have productGroup table which contains mainly productGroupId, ParentProductGroupId, Active colums. where i can set parent product groupid.
The second table is product table where i can specify productgroup of the product.
Now one product group in active then the products in that group shouldn't come in select statement. not only product group parent product group of that group also.

how to write query please help me.

Product Group Table

GroupId ParentGroupId Active
1001 Null true ->this is parent group
1002 1001 true ->Child of 1001
1003 1002 false ->child of 1002

like this i can create no of groups

Product Table

productid groupId

101 1001
102 1002
103 1003

if 1001 group is inactive the in select no products should come.
if 1001 is active and 1002 is inactive then 102 and 103 shouldn't come and 101 should come.

Author: Narayanan             
Posted Date: September 29, 2011     Points: 20   

Please refer this site..it may be useful

Regards, Lakshmi Naraayanan.S

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend