Welcome to Help4Web.co.uk - Web Design Help, Html Tutorial, Php, Asp , SQL help and CCNA, MCSE definitions!
Google
Webkpop-web.com

     Main Menu

· Home
· Free Downloads
· Computing FAQ
· Contact Us
· Free Software Downloads
· Tech Forum
· Technology News
· Web Design Help
· Web Links
· Your Online Account
· Your PM



     Web Browser


     Website Links
Supermediastore! #1 in Computer media & Accessory

White Papers IT
Learn Korean
Chinese Pop Music
Advertise Kpop
Korean Pop Site Map
Web Design
Pop Music
Chinese Girls
HK Pop Korean Music
Lee Hyori
Hyori
Boa Park Ji Yoon
Baby Vox YG Family
Jeon Ji Hyun
1 Tym Ha Ji Won
Shyne Rain Bi
Shin Mina SM Town
Fly to the Sky
Korean Girls and Models
Nicholas Tse
161 Clan
보아
Edison Chen
Sung Hi Lee
Shinhwa
Andy Lau Jay Chou
White Papers
Case Study SES
Kelly Chen
Liu Yi Fei Sammi Cheng
Jordan Chan Music
Computer Jobs IT

Computer Help Forum and Programming Advice :: View topic - forum sql help needed
 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile   Log inLog in 

forum sql help needed

 
Post new topic   Reply to topic    Computer Help Forum and Programming Advice Forum Index -> SQL and Databases
View previous topic :: View next topic  
Author Message
tomallen35
Freshman
Freshman


Joined: Feb 04, 2005
Posts: 1

PostPosted: Sat Feb 05, 2005 7:50 am    Post subject: forum sql help needed Reply with quote

can anyone help me with a problem i've been having with my sql select statement i'm trying to write to view all threads on a given topic?

The table structure i'm using is as follows:

CREATE TABLE member
(
mem_id integer NOT NULL,
em_add varchar(50) NOT NULL,
password varchar(20) NOT NULL,
name varchar(15) NOT NULL,
avatar varchar(150) NOT NULL,
points integer,
lastlogin date NOT NULL,
joined date NOT NULL,
PRIMARY KEY (mem_id)
);

CREATE TABLE topic
(
topic_id integer NOT NULL,
title varchar(50) NOT NULL,
description varchar(300) NOT NULL,
PRIMARY KEY (topic_id)
);

CREATE TABLE thread
(
thread_id integer NOT NULL,
topic_id integer NOT NULL,
title varchar(50) NOT NULL,
c_em_add varchar(50) NOT NULL,
created date NOT NULL,
sticky char(1) NOT NULL,
PRIMARY KEY (thread_id)
);

CREATE TABLE message
(
msg_id integer NOT NULL,
thread_id integer NOT NULL,
title varchar(50),
body varchar(1000) NOT NULL,
c_em_add varchar(50) NOT NULL,
created date NOT NULL,
PRIMARY KEY (msg_id)
);

Amongst others....

The code i tried was:

SELECT DISTINCT thread.thread_id,thread.title,member.name,
member.avatar,member.mem_id,thread.created,thread.sticky,MAX(message.created) AS lastPost,COUNT(message.msg_id)
FROM topic,thread,message,member
WHERE message.thread_id = thread.thread_id
AND thread.topic_id = request.getParameter("topic") AND thread.c_em_add = member.em_add
GROUP BY thread.thread_id,thread.title,thread.created,
thread.sticky,topic.title,member.name,member.avatar,member.mem_id
ORDER BY thread.sticky DESC, lastPost DESC;

All this outputs is one thread so when a new thread is created, it is not showing up.

Any ideas?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Computer Help Forum and Programming Advice Forum Index -> SQL and Databases All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum







Learn Chinese | Learn cantonese | Learn Mandarin | Grace Park | Party Organisers | Kaila yu | Phone Card | Twins | Chinese Society | Loans UK | BokuMaro | CV Help Book | Chinese Wife | Korean Singles | British Born Chinese | Bae Yong Jun | Speak Korean | Chinese Models | Music | Information Security Management | Maritime Greenwich Campus | Covering Letters Help | Chinese Music | Jang Nara | SES | YG Family | Learn Korean | Firewall Definition | Server Definition | Wireless Network Definition | E-Commerce Definition | Sales Leads | Application Firewall | CCNA definitions | Research Papers | Webcast | CV Help

Author KPop Music :- Jon Bock ( Chinese Pop Music Learn Korean )
Produced by Kpop-Web Design Associates, all rights not reserved.
Internet Marketing and Search Engine Optimisation Software Defined Radio