navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Free FrontPage Templates

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

RE: Help with sql statement

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> RE: Help with sql statement
Page: <<   < prev  1 [2]
 
dzirkelb1

 

Posts: 1315
Joined: 10/5/2004
From: Cedar Rapids, Iowa
Status: offline

 
RE: Help with sql statement - 4/19/2005 11:54:10   
currently it displays a seq1 value, but it is incorrect as the seq number doesn't match up with the correct store id on the route...it matches with store ID on a previous route, but not for the current route.

(in reply to dzirkelb1)
BeTheBall

 

Posts: 6381
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: Help with sql statement - 4/19/2005 13:17:49   
I think this one works, but sadly, it won't speed things up any:

SELECT Q1.[KFC ID], Q1.[TB ID], Q1.MaxEvalDate, Q2.SEQ1 FROM (SELECT SEQ1, [KFC ID], [TB ID] FROM [MASTER ROUTE TABLE 1998] WHERE RT1=10873) AS Q2 INNER JOIN (SELECT [MASTER ROUTE TABLE 1998].[KFC ID], [MASTER ROUTE TABLE 1998].[TB ID], Max([MASTER ROUTE TABLE 1998].EvalDate) AS MaxEvalDate
FROM [MASTER ROUTE TABLE 1998]
WHERE [MASTER ROUTE TABLE 1998].[KFC ID] IN (SELECT [KFC ID] FROM [MASTER ROUTE TABLE 1998] WHERE RT1 = 10873) OR [MASTER ROUTE TABLE 1998].[TB ID] IN (SELECT [TB ID] FROM [MASTER ROUTE TABLE 1998] WHERE RT1 = 10873) GROUP BY [MASTER ROUTE TABLE 1998].[KFC ID], [MASTER ROUTE TABLE 1998].[TB ID]) AS Q1 ON Q1.[KFC ID]=Q2.[KFC ID] OR Q1.[TB ID]=Q2.[TB ID]

Q1 and Q2 are random names assigned to the two subqueries that are created.

I really wonder if normalizing your db would speed it up, but that would require a lot of work on your part. Normalizing would entail breaking up your one big table into smaller ones. Most of your current columns would become their own table with just the column info and an autonumber ID field. EvalDates would include only the date and the ID of the store evaluated. You then use joins to bring needed information together. I also think you would benefit from a table that gave each store a unique ID instead of a set of TB IDs and KFC IDs. You could simply take the current ID and precede it with at T or K.

Just my $.02

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to dzirkelb1)
dzirkelb1

 

Posts: 1315
Joined: 10/5/2004
From: Cedar Rapids, Iowa
Status: offline

 
RE: Help with sql statement - 4/19/2005 13:28:24   
Yup, that statement works correctly as advertised...thanks!!!

ya, not sure what I can do with the slowness, I can't chagne id's at all as some have a kfc id and a tb id...why? who the heck knows :)

I do have a table that has all the info for id's in a specefic table...I am not sure if they have a specefic ID in that table or not.

I am going to compact the database this week as it really needs also, and clean up all of the junk in it...its sooo full of junk, and its been a project I wanted to do once I started here.

again, thanks for all of your help!! I'll see what I can do :)

(in reply to dzirkelb1)
Page:   <<   < prev  1 [2]

All Forums >> Web Development >> ASP and Database >> RE: Help with sql statement
Page: <<   < prev  1 [2]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts