BetaONE will rise again!


Reply
  #1  
Old 3rd Jan 06, 07:31 AM
*MO*'s Avatar
*MO* *MO* is offline
Senior Member
 
Join Date: Aug 2002
Location: Cape Town
Posts: 311
*MO* is an unknown quantity at this point
Send a message via MSN to *MO*
MySQL Query
Hi Everyone. I've got a problem with an SQL query. I'm gonna try my best to explain the structure and the problem i'm having.

I've got 2 tables. one is called 'articles', and the other is called 'sections'
the articles table has a foreign key called sectionsID which will be the same as the secions.id.

Now the sections table also has a field that specifies if the section is hidden or not. field is called sections.hidden and is an enum of 'Y', and 'N'.

so i can say :
SELECT articles.* FROM articles,sections WHERE sections.hidden = 'N'

easy

but the articles.sectionID can store more than one sections ID. ie: 3-4
which means, that this article is in section 3 and section 4.

however, section 3 is hidden. 4 is NOT hidden.

but when i do a query to show all articles, i want it show this article, even tho its in 3 and is hidden, but because its in 4, it will be visible.
if it was JUST in section 3, then it would not show.

If its gonna make is easier, this is for a blog system. so you can understand what i'm trying to do.

Any help would really be great. Thank you
Reply With Quote
  #2  
Old 3rd Jan 06, 10:13 AM
*MO*'s Avatar
*MO* *MO* is offline
Senior Member
 
Join Date: Aug 2002
Location: Cape Town
Posts: 311
*MO* is an unknown quantity at this point
Send a message via MSN to *MO*
K. Seemed to have fixed it.

I added another field to the end of the articles table, which specifies if the article is safe to show on all pages. when i do an insert or update, the script checks if the article will be part of a "Safe" section, and if it is, then it'll display. if its not part of a safe section, then it'll block it

regards,
Mo
Reply With Quote
  #3  
Old 3rd Jan 06, 11:05 AM
JacKDynne's Avatar
JacKDynne JacKDynne is offline
Administrator
 
Join Date: Oct 2001
Location: The Past Through Tomorrow
Posts: 1,591
JacKDynne will become famous soon enoughJacKDynne will become famous soon enough
Send a message via MSN to JacKDynne
And that is what I was gonna suggest you do



/JD
__________________


Reply With Quote
  #4  
Old 4th Jan 06, 07:09 AM
*MO*'s Avatar
*MO* *MO* is offline
Senior Member
 
Join Date: Aug 2002
Location: Cape Town
Posts: 311
*MO* is an unknown quantity at this point
Send a message via MSN to *MO*
hehehe

thanx
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Big Bill bash for partner launch of SQL 2005 Alpine BetaONE News 0 21st Oct 05 09:16 PM
Access vs. SQL vs. Other DB PCTech Coders Corner 9 8th Jul 05 02:50 PM
SQL Server 2000 SP4 enables support for WOW64 NewsBot NeoWin News 0 8th May 05 06:00 PM
SQL Server 2000 SP4 enables support for AMD64 and Itanium NewsBot NeoWin News 0 7th May 05 06:00 PM
Microsoft details SQL Server 2005 family NewsBot ieXbeta News 0 1st Mar 05 03:30 PM


All times are GMT +1. The time now is 08:19 AM.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.