Help with an SQL Statement

From: Reapes (nospam.reapesuk_at_hotmail.com)
Date: 09/18/04


Date: Sat, 18 Sep 2004 21:07:22 GMT

Hi Group,

I have two tables in SQL Server.

Table one is called Category with fields :

CategoryID and CategoryName.

Table two is called SubCategory with fields:

SubCategoryID
CategoryID
SubCategoryName

In Table one I have say 2 categories, Birthday and Easter.
In Table two I have 2 sub categories of Male and Female which are sub
categories of Table ones Birthday entry.

What I would Like to return (if possible) using an SQL statement is the
following:

Birthday
Male
Female
Easter

i.e. first the MAIN category, then the sub categories for that main category
then onto the next category etc etc.

All the queries I have tried failed miserably! Is there any sql gurus out
there that can point me in the right direction?

Many Thanks

Reapes



Relevant Pages

  • Re: Simple Insert Into...
    ... it is in a control on the form; and is unbound (it's actually a combo ... box that is used as a dropdown list, values taken from a different table; SQL ... I need this value to assign a unique ID to the entire recordset being ... In your form's Sub, you'll wind up with something like the following: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Simple Insert Into...
    ... You can store unbound control data in a variable, ... in the sql. ... Dim strSQL As String ... In your form's Sub, you'll wind up with something like the following: ...
    (microsoft.public.access.modulesdaovba)
  • Re: Make Table Query
    ... Sub GetExcelFiles(strAccess as string, strDir as string) ... ' strDir - name of the directory to get Excel files. ... Looking at your reply I think I can insert the SQL piece into code ...
    (microsoft.public.access.queries)
  • Re: search by 1 of 3 combos
    ... I guess I should expand a bit on an example of what you can do with modifying SQL for a search combo... ... , mWhere as string ... Dim mRecordID As Long ... Private Sub cmd_search_Click ...
    (microsoft.public.access.formscoding)
  • Re: Combo Box - How to populate from a table
    ... through the records in the recordset. ... Private Sub Form_Load ... oRS.Open sSQL, oConn, adOpenForwardOnly, adLockReadOnly, adCmdText ... 'and retrieves all rows in the table (same as the above SQL but the ...
    (microsoft.public.vb.controls)