Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 01-12-2005, 04:31 PM   #1 (permalink)
mo551
Registered User
 
Join Date: Jan 2005
Posts: 1
mo551 is on a distinguished road
Count Problem

Hi All!

i am having a big problem doing following query?

question is "List the titles and creation dates of all blogs, as well as the total number of blog entries associated with that blog?"

the query should look at the "Subject_Title" in the blog_Entries table and "PostComment" field from PostReply table. the count should count the Subject_title and how many post reply it has for that subject.

this is my code
"select BLOG_ENTRIES_ID,Creation_DATE, count(PostComment)
from Blog_Entries, PostReply
where Subject_Title=PostComment
group by BLOG_ENTRIES_ID,Creation_DATE;"

i have try everything i don what to do now? please help me
i have below list the two tables;

thanking u in advance
bye
Mo
==================================================
CREATE TABLE Blog_Entries
(BLOG_ENTRIES_ID VARCHAR2(20) PRIMARY KEY,
EMAIL VARCHAR2(20), CONSTRAINT Blog_Entries_FOREIGN_KEY FOREIGN KEY (EMAIL) REFERENCES Bloggers (EMAIL),
Creation_DATE DATE DEFAULT SYSDATE,
Subject_Title VARCHAR2(40),
Entries_Text VARCHAR2(160));
==================================================
CREATE TABLE PostReply
(POST_REPLY_ID VARCHAR2(8) PRIMARY KEY,
BLOG_ID VARCHAR2(10), CONSTRAINT PostReply_FOREIGN_KEY FOREIGN KEY (BLOG_ID) REFERENCES Blog (BLOG_ID),
Subject VARCHAR2(40),
PostComment VarChar2(1000),
REPLY_DATE DATE DEFAULT SYSDATE);
==================================================
mo551 is offline   Reply With Quote
Old 01-12-2005, 06:31 PM   #2 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
Not sure what subject_title or postComment (is this the comment text?) has to do with anything since it seems like each blog entry has a unique numeric ID. (I assume that is what blog_entries_id and blog_id are)

A simple query might be:
Code:
select count(*) as bcount
from postreply
where blog_id=4
..obviously replacing 4 with the current blog_entries_id that you're counting for. The easiest way is to do this in two queries. One to fetch the date/subject/etc for the blog then another (similar to above) to count the comments.

-r
idx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Assignment (Urgent help req.) Boltress Standard C, C++ 0 01-12-2005 07:59 AM
looping problem maria_arif MS Technologies ( ASP, VB, C#, .NET ) 1 11-29-2004 08:07 AM
Help debugging a power problem Belisarius Lounge 0 10-25-2003 04:44 PM
structure problem Goshi Standard C, C++ 5 04-21-2003 12:19 AM
This is a windows/C problem UnderWing Standard C, C++ 6 03-28-2003 06:17 AM


All times are GMT -8. The time now is 10:54 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting