Geeks Talk

Prepare for your Next Interview




tell me the query using joins and count!

This is a discussion on tell me the query using joins and count! within the SQL forums, part of the Databases category; Can any one please tell me the query for the given scenario: I have a very bad knowledge with SQL queries,so kindly help me: I have two tables "Advertisement" ...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-18-2007
Junior Member
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ramesh_vwk is on a distinguished road
tell me the query using joins and count!

Can any one please tell me the query for the given scenario:

I have a very bad knowledge with SQL queries,so kindly help me:

I have two tables "Advertisement" and "responses".
Advertisement table fields are: AdID(unique),title,username
responses table fields are:AdID(which is the same value in Advertisement table),responses.(it may have any number odf responses for the same Ad id)

Now i need a single query in which i should get the Adid,Title and the count of number of responses to the Adid:
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-19-2007
Junior Member
 
Join Date: Feb 2007
Location: Khanna
Posts: 28
Thanks: 0
Thanked 5 Times in 5 Posts
reet_dhiman is on a distinguished road
Re: tell me the query using joins and count!

hello ramesh ,
try if the fllowing can help ur problem.

select adid a,adid r, count(r.responses),title a from advertisement
a,responses r where a.adid=r.adid group by a.adid.



if u get the right answer do let me know will explian you the whole scene.

reet dhiman
Reply With Quote
The Following User Says Thank You to reet_dhiman For This Useful Post:
  #3 (permalink)  
Old 08-19-2007
Junior Member
 
Join Date: Aug 2007
Location: BANGALORE
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
rameshvamshy is on a distinguished road
Re: tell me the query using joins and count!

thanks for clarifying me
Reply With Quote
  #4 (permalink)  
Old 08-20-2007
Junior Member
 
Join Date: Aug 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ramesh_vwk is on a distinguished road
Smile Re: tell me the query using joins and count!

Hai reet_dhiman,
Its working fine.Thanks for ur quick response.Thanks a lot.
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
How the joins work in SQL savitha_shankar Database General 11 07-15-2008 11:06 AM
Open defect count prasu Testing Templates 2 10-24-2007 08:46 AM
I want to tune four tables and 5 joins condition Caleb Sima and Vincent Li Oracle 2 06-29-2007 09:19 AM
What is the Difference between Count & Count all function in Business Objects nikitababaria Data Warehousing 2 05-30-2007 01:08 PM
Can you Count sripri Brainteasers 1 08-17-2006 05:25 AM


All times are GMT -4. The time now is 09:06 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved