Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Pulling the latest data from joined tables ...
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

CrAzY
New Member

USA
50 Posts

Posted - 26 March 2001 :  14:20:55  Show Profile  Send CrAzY an AOL message  Send CrAzY an ICQ Message
I've got the following tables in SQL Server for this page - Nokturnal.Net/Radio :

Nokturnal_Radio
Radio_Id int
Radio_Date datetime
Radio_Start datetime
Radio_End datetime
Radio_Name varchar
Radio_Genre varchar
Radio_Desc varchar

Nokturnal_Artists
Artists_Id
Artists_Name
Artists_Affiliation
Artists_Email
Artists_Bio

Nokturnal_Radio_Artists
Radio_Id
Artists_Id

If you click on 'HOME' you'll notice I try and pull the 'TOP 1 * From' the tables, only I have to pull the TOP 3 in order to have 3 Artists listed, If I do TOP 1, it only lists one artists on the HOME page.

Here is the current SQL Statement I'm using for the HOME page:


<%
SQL = "Select Top 3 * From Nokturnal_Radio, Nokturnal_Artists, Nokturnal_Radio_Artists Where Nokturnal_Radio.Radio_Id = Nokturnal_Radio_Artists.Radio_Id And Nokturnal_Radio_Artists.Artists_Id = Nokturnal_Artists.Artists_Id Order By Nokturnal_Radio.Radio_Date"
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.Open SQL, NokturnalDB
%>


Can anyone suggest how I might be able to just pull the latest Records according to "Radio_Date".

I'd also like to expire the Records if the date has passed, but I'd like to put them into an archive Table(s). Any suggestions how I might setup my DB to Insert the expired records into an archived table(s) and then delete them when the date has passed?

I'm Beyond Help


Edited by - CrAzY on 26 March 2001 14:21:37

CrAzY
New Member

USA
50 Posts

Posted - 27 March 2001 :  14:22:51  Show Profile  Send CrAzY an AOL message  Send CrAzY an ICQ Message
So I realized what my situation is similar to ... hopefully some of you might have a better understanding of what I'm trying to do with this example.

It's like a store with Categories (What I would consider my shows/events), and Products (The artists) in those categories.

So my question is ... how do I pull the "TOP 1" Category with all of it's products

I'm Beyond Help
Go to Top of Page

Aznknight
Senior Member

USA
1373 Posts

Posted - 27 March 2001 :  14:39:14  Show Profile  Send Aznknight an AOL message  Send Aznknight an ICQ Message
quote:

So my question is ... how do I pull the "TOP 1" Category with all of it's products



Hi Crazy,
I like your site and radio. Will turn in sometime , what do your dj's spin?
We have a radio schedule too, like every sunday evening pacific time.
Maybe we can hook up and have guest dj's appearances on each other sites.
Our site is still growing and the audience is still small at this time, but it's still great to listen to live tunes.

To get back to your question. Here's a schematic of it.
What I would do is have a category_id field in the products table that points to the category that it belongs too.

Next "select top 1 * category order by date desc"
then cat_id = rs(cat_id)
then "select * from products where cat_id = " & cat_id

Now you have all the products of the latest cateogory. Hope this help

You can probably combined this into a single sql call but it's more complicated that way.

- Alan
www.iamviet.com

Edited by - aznknight on 27 March 2001 14:40:18
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07