Click here to Skip to main content
15,902,635 members
Home / Discussions / Database
   

Database

 
GeneralRe: (Actually it wasn't) Pin
Jörgen Sigvardsson7-Nov-03 3:11
Jörgen Sigvardsson7-Nov-03 3:11 
AnswerRe: Must be a permissions thing, but what? Pin
Giles7-Nov-03 3:49
Giles7-Nov-03 3:49 
GeneralRe: Must be a permissions thing, but what? Pin
Colin Angus Mackay7-Nov-03 5:10
Colin Angus Mackay7-Nov-03 5:10 
Generaldate Pin
Anonymous6-Nov-03 2:26
Anonymous6-Nov-03 2:26 
GeneralRe: date Pin
Colin Angus Mackay6-Nov-03 3:59
Colin Angus Mackay6-Nov-03 3:59 
GeneralRe: date Pin
Anonymous6-Nov-03 4:36
Anonymous6-Nov-03 4:36 
GeneralRe: date Pin
Colin Angus Mackay6-Nov-03 4:49
Colin Angus Mackay6-Nov-03 4:49 
GeneralSQL Statement question. Pin
theJazzyBrain6-Nov-03 1:25
theJazzyBrain6-Nov-03 1:25 
I have a table in SQL Server 2000 as such:

categoryId
categoryParentId
categoryName

I want the categories in hierarchical structure thats why I have the parentId. All top level categories have categoryParentId equal to 0. All other subcategories have a categoryParentId that is equal to the categoryId of their parent category.

I have the following statement:

<br />
SELECT categoryId, categoryParentId, categoryName<br />
FROM categories<br />
WHERE categoryParentId=" & parentId & " OR categoryId=" & parentId<br />


The OR categoryId= will also return the parent category along with its children.

The problem that I am facing is:
I need to modify the statement in such way that it will also provide me with a TRUE or FALSE value for each category that will let me know if the category has children. I cannot change the table at all on the database. I need to do this from within the SQL statement.

Any ideas?

Thank you

theJazzyBrain
Wise is he who asks good questions, not he who gives good answers
GeneralRe: SQL Statement question. Pin
Roger Wright6-Nov-03 3:24
professionalRoger Wright6-Nov-03 3:24 
GeneralRe: SQL Statement question. Pin
theJazzyBrain6-Nov-03 5:53
theJazzyBrain6-Nov-03 5:53 
GeneralRe: SQL Statement question. Pin
Jeff Varszegi6-Nov-03 6:57
professionalJeff Varszegi6-Nov-03 6:57 
GeneralRe: SQL Statement question. Pin
theJazzyBrain6-Nov-03 7:36
theJazzyBrain6-Nov-03 7:36 
GeneralRe: SQL Statement question. Pin
Jeff Varszegi6-Nov-03 7:39
professionalJeff Varszegi6-Nov-03 7:39 
GeneralRe: SQL Statement question. Pin
theJazzyBrain6-Nov-03 21:48
theJazzyBrain6-Nov-03 21:48 
GeneralRe: SQL Statement question. Pin
Jeff Varszegi7-Nov-03 2:43
professionalJeff Varszegi7-Nov-03 2:43 
GeneralRe: SQL Statement question. Pin
theJazzyBrain7-Nov-03 4:04
theJazzyBrain7-Nov-03 4:04 
Generaluser acces spermissions Pin
ranjjj6-Nov-03 0:10
ranjjj6-Nov-03 0:10 
GeneralRe: user acces spermissions Pin
perlmunger6-Nov-03 10:57
perlmunger6-Nov-03 10:57 
GeneralRe: user acces spermissions Pin
ranjjj6-Nov-03 17:36
ranjjj6-Nov-03 17:36 
GeneralRe: user acces spermissions Pin
perlmunger7-Nov-03 5:38
perlmunger7-Nov-03 5:38 
GeneralProblem in using OleDbDataReader Pin
sivaramakrishna5-Nov-03 22:14
sivaramakrishna5-Nov-03 22:14 
GeneralRe: Problem in using OleDbDataReader Pin
Mike Dimmick6-Nov-03 2:32
Mike Dimmick6-Nov-03 2:32 
GeneralRe: Problem in using OleDbDataReader Pin
sivaramakrishna7-Nov-03 19:06
sivaramakrishna7-Nov-03 19:06 
Generaldbo Pin
Hugo Hallman5-Nov-03 12:19
Hugo Hallman5-Nov-03 12:19 
GeneralSQL! Pin
Silly Boy5-Nov-03 6:18
Silly Boy5-Nov-03 6:18 

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.