Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2004, 12:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default Left Join-Count Records On 2nd Table

Is there a way to get a count on just the number of records on TB2 table. I have tried using Count() but I get an error, so I don't think I am using it correctly.

"SELECT TB1.Category_ID, TB1.Category_Name, TB2.Item_ID, TB2.Item_Name " &_
"FROM TB1 " &_
"LEFT JOIN TB2 " &_
"ON TB1.Category_ID = TB2.Category_ID_TB2 " &_
"WHERE TB1.Category_ID = " & strSelectedCategory & " ORDER BY TB2.Item_Name;"

Many Thanks
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old September 16th, 2004, 02:49 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu
Default

Hi ,
  The folowing code will help you in this regard.

"SELECT count(distinct TB2.Item_ID) " &_
"FROM TB1 " &_
"LEFT JOIN TB2 " &_
"ON TB1.Category_ID = TB2.Category_ID_TB2 " &_
"WHERE TB1.Category_ID = " & strSelectedCategory & " ORDER BY TB2.Item_Name;"

Thanks
Suresh Babu






Similar Threads
Thread Thread Starter Forum Replies Last Post
updating table w/ query that has left join msordo VB.NET 2002/2003 Basics 4 April 11th, 2008 11:26 AM
left join msrnivas Classic ASP Databases 2 October 15th, 2004 07:37 AM
Insert multiple records in a Inner Join Table rylemer Access 1 August 22nd, 2004 07:44 AM
Oracle 8i inner join and left join problem puteri_84 Oracle 2 August 19th, 2004 07:14 AM
Insert multiple records in a Inner Join Table rylemer Access VBA 0 July 19th, 2004 03:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.