Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. select query and group by in sqlserver

select query and group by in sqlserver

Scheduled Pinned Locked Moved ASP.NET
helpdatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sarvesh upadhyay
    wrote on last edited by
    #1

    hi, have a problem i want to select all records from left table and corresponding records from right table using group by clause. my tsqlstatement is select A.CatId,A.CategoryName,A.CategoryImage, Count(B.ProductId),count(B.SubCatId) from Tbl_Category as A Left outer join Tbl_CategoryWiseProduct as B on A.CatId=B.CatId group by A.CatId,A.CategoryName,A.CategoryImage but is does not working properly help

    B 1 Reply Last reply
    0
    • S sarvesh upadhyay

      hi, have a problem i want to select all records from left table and corresponding records from right table using group by clause. my tsqlstatement is select A.CatId,A.CategoryName,A.CategoryImage, Count(B.ProductId),count(B.SubCatId) from Tbl_Category as A Left outer join Tbl_CategoryWiseProduct as B on A.CatId=B.CatId group by A.CatId,A.CategoryName,A.CategoryImage but is does not working properly help

      B Offline
      B Offline
      benqazou
      wrote on last edited by
      #2

      This query looks like yours, I performed it on Northwind database, and it works : select Categories.CategoryId, Categories.CategoryName, count(products.productid) as total from Categories, Products where Categories.Categoryid = Products.Categoryid group by Categories.categoryid, Categories.Categoryname Hope this will help you. What's the meaning (in business terms) of SubCatId?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups