Click here to Skip to main content
15,920,704 members
Home / Discussions / Database
   

Database

 
GeneralRe: A loop in T-SQL ? Pin
Sebastien Lachance16-Nov-04 7:05
Sebastien Lachance16-Nov-04 7:05 
GeneralRe: A loop in T-SQL ? Pin
Colin Angus Mackay16-Nov-04 9:45
Colin Angus Mackay16-Nov-04 9:45 
GeneralRe: A loop in T-SQL ? Pin
Sebastien Lachance16-Nov-04 9:54
Sebastien Lachance16-Nov-04 9:54 
GeneralRe: A loop in T-SQL ? Pin
Colin Angus Mackay16-Nov-04 10:04
Colin Angus Mackay16-Nov-04 10:04 
GeneralDELETE X WHERE Y IN (SubQuery) Problem Pin
Tristan Rhodes16-Nov-04 0:55
Tristan Rhodes16-Nov-04 0:55 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Colin Angus Mackay16-Nov-04 1:38
Colin Angus Mackay16-Nov-04 1:38 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Tristan Rhodes16-Nov-04 3:17
Tristan Rhodes16-Nov-04 3:17 
GeneralRe: DELETE X WHERE Y IN (SubQuery) Problem Pin
Colin Angus Mackay16-Nov-04 5:46
Colin Angus Mackay16-Nov-04 5:46 
The Catalyst wrote:
I don't fully understand the As SubQuery thing

Maybe it is a SQL Server thing. INNER JOINs onto subqueries don't work in SQL Server unless you name the subquery.

Okay. As it is quite difficult to read the SQL in this form let's extract it:

DELETE FROM Description WHERE Description.BasicDesc IN 
(SELECT Description.BasicDesc 
FROM ((Category INNER JOIN SubCategory ON Category.CategoryKey = SubCategory.CategoryKey) 
INNER JOIN Description ON SubCategory.SubCategoryKey = Description.SubCategoryKey 
WHERE ((Category.CategoryDescription)='xxxxx')))

Alot of these parethesis are confusing. And quite frankly I'd remove all except the ones shown:
DELETE FROM Description WHERE Description.BasicDesc IN 
(SELECT Description.BasicDesc 
FROM Category 
INNER JOIN SubCategory ON Category.CategoryKey = SubCategory.CategoryKey
INNER JOIN Description ON SubCategory.SubCategoryKey = Description.SubCategoryKey 
WHERE Category.CategoryDescription='xxxxx')

I don't know if that makes any difference. The only other way I'd do it is something like this:
DELETE Description
FROM Description
INNER JOIN SubCategory ON SubCategory.SubCategoryKey = Description.SubCategoryKey 
INNER JOIN Category ON Category.CategoryKey = SubCategory.CategoryKey
WHERE Category.CategoryDescription='xxxxx')

But that may just work in SQL Server.




Do you want to know more?


QuestionHow to import both adoce31.dll & adoxce31.dll? Pin
george ivanov16-Nov-04 0:53
george ivanov16-Nov-04 0:53 
GeneralDeclare Varibales In SQL 2000 Pin
Hemant Mane15-Nov-04 19:03
Hemant Mane15-Nov-04 19:03 
GeneralSequential Dates and Grouping Pin
Peet Schultz15-Nov-04 2:47
Peet Schultz15-Nov-04 2:47 
GeneralRe: Sequential Dates and Grouping Pin
Michael Potter15-Nov-04 3:33
Michael Potter15-Nov-04 3:33 
GeneralRe: Sequential Dates and Grouping Pin
Peet Schultz15-Nov-04 4:11
Peet Schultz15-Nov-04 4:11 
GeneralRe: Sequential Dates and Grouping Pin
Michael Potter15-Nov-04 8:10
Michael Potter15-Nov-04 8:10 
GeneralGenerate SQL Script ( store procedure problem) Pin
manxx14-Nov-04 8:40
manxx14-Nov-04 8:40 
GeneralView all Tables in database Pin
visitsaadi13-Nov-04 1:33
visitsaadi13-Nov-04 1:33 
GeneralRe: View all Tables in database Pin
Colin Angus Mackay13-Nov-04 1:51
Colin Angus Mackay13-Nov-04 1:51 
QuestionSelect Top 10 from a DataTable ??? Pin
luckyShek12-Nov-04 9:56
luckyShek12-Nov-04 9:56 
GeneralStored Procedures Pin
Anonymous12-Nov-04 6:02
Anonymous12-Nov-04 6:02 
GeneralRe: Stored Procedures Pin
Colin Angus Mackay12-Nov-04 6:41
Colin Angus Mackay12-Nov-04 6:41 
GeneralRe: Stored Procedures Pin
Anonymous14-Nov-04 22:38
Anonymous14-Nov-04 22:38 
QuestionHow to back up database on remote computer?? Pin
venadder12-Nov-04 5:07
venadder12-Nov-04 5:07 
GeneralConnection String for Connection to OLAP Server Pin
mysorian11-Nov-04 16:50
professionalmysorian11-Nov-04 16:50 
GeneralRe: Connection String for Connection to OLAP Server Pin
David Salter11-Nov-04 23:47
David Salter11-Nov-04 23:47 
GeneralFrom a Blob to some type of image in Java Pin
Red Sunday11-Nov-04 9:39
Red Sunday11-Nov-04 9:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.