Dumb SQL question

Dumb SQL question

Post by Kevin McElhine » Tue, 01 Dec 1998 04:00:00



Hello group!

I know that this is a stupid question, but I can't find the answer despite
looking it up in a couple of SQL references. Following is a snippet of SQL
from a sample VB program:

     sSQL = "SELECT Authors.Author, Titles.Title," & _
        "Titles.ISBN FROM Titles INNER JOIN " & _
        "(Authors INNER JOIN [Title Author] " & _
        "ON Authors.Au_ID = [Title Author].Au_ID) " & _
        "ON Titles.ISBN = [Title Author].ISBN " & _
        "WHERE Authors.Au_ID = " & LstrAuID & _
        " ORDER BY Authors.Author, Titles.Title"

Here are my questions:

1. What does [Title Author] mean? Is this what they mean by a virtual table,
or view? If so, I can't see from the syntax how this view is being created
in the subquery. Authors and Titles are both valid tables, and it seems that
[Title Author] is being referenced without explicitly creating it...

2. Is this SQL syntax standard? Can someone give me the name of a book that
will explain this?

Thanks much,
Kevin McElhiney

 
 
 

Dumb SQL question

Post by Mike » Wed, 02 Dec 1998 04:00:00


With VB it is possible to create tables, fields, queries, etc. using
multi-word names.  To access the item in question, you need to enclose the
words in square brackets.  So [Title Author] is a query result.  I have only
just begun using INNER JOIN so don't really understand this SQL fully but I
do know that this will take the Author field from the Authors table, the
Title fields from the Title table and create a new table called Title Author
listing all the books that each author wrote, something like :

Stephen King    Carrie
Stephen King    Stand, The
Dean Koontz     Key To Midnight, The
Dean Koontz     Mr.. *

By the way, there is no such thing as a dumb question.  Only dumb answers
and I hope I have not made one of the latter.


>Hello group!

>I know that this is a stupid question, but I can't find the answer despite
>looking it up in a couple of SQL references. Following is a snippet of SQL
>from a sample VB program:

>     sSQL = "SELECT Authors.Author, Titles.Title," & _
>        "Titles.ISBN FROM Titles INNER JOIN " & _
>        "(Authors INNER JOIN [Title Author] " & _
>        "ON Authors.Au_ID = [Title Author].Au_ID) " & _
>        "ON Titles.ISBN = [Title Author].ISBN " & _
>        "WHERE Authors.Au_ID = " & LstrAuID & _
>        " ORDER BY Authors.Author, Titles.Title"

>Here are my questions:

>1. What does [Title Author] mean? Is this what they mean by a virtual
table,
>or view? If so, I can't see from the syntax how this view is being created
>in the subquery. Authors and Titles are both valid tables, and it seems
that
>[Title Author] is being referenced without explicitly creating it...

>2. Is this SQL syntax standard? Can someone give me the name of a book that
>will explain this?

>Thanks much,
>Kevin McElhiney


 
 
 

Dumb SQL question

Post by Jeff Smit » Wed, 02 Dec 1998 04:00:00


Jet databases (and some others) will allow spaces in their object names,
such as tables or fields. From the SQL statement you show, [Title Author] is
a table, probably used to connect the Authors and the Titles tables. This
would actually be required, since Authors-to-Titles would be a many-to-many
relationship (one book could be written by many authors, and one author
could write many books).

Jeff Smith


>Hello group!

>I know that this is a stupid question, but I can't find the answer despite
>looking it up in a couple of SQL references. Following is a snippet of SQL
>from a sample VB program:

>     sSQL = "SELECT Authors.Author, Titles.Title," & _
>        "Titles.ISBN FROM Titles INNER JOIN " & _
>        "(Authors INNER JOIN [Title Author] " & _
>        "ON Authors.Au_ID = [Title Author].Au_ID) " & _
>        "ON Titles.ISBN = [Title Author].ISBN " & _
>        "WHERE Authors.Au_ID = " & LstrAuID & _
>        " ORDER BY Authors.Author, Titles.Title"

>Here are my questions:

>1. What does [Title Author] mean? Is this what they mean by a virtual
table,
>or view? If so, I can't see from the syntax how this view is being created
>in the subquery. Authors and Titles are both valid tables, and it seems
that
>[Title Author] is being referenced without explicitly creating it...

>2. Is this SQL syntax standard? Can someone give me the name of a book that
>will explain this?

>Thanks much,
>Kevin McElhiney

 
 
 

Dumb SQL question

Post by Ikiiiiii » Mon, 07 Dec 1998 04:00:00


Really great book tip on advanced SQL:

Joe Celkos  "SQL for smarties"

love that book, but it's for experienced SQL users only

enjoy, Erik

 
 
 

1. Dumb SQL Question

I am writing an ace report & there are two table with fields that have the
same
name, How do I print both fields? Below is an example of my code:

select ...
         bill_complete.detail,
         dist_method.detail,
         ...
from ...,
       bill_complete,
       dist_method,
       ...
where ... and
         ....
end

format

...

on every row
   print ??? detail, ??? detail

...

end

Thanks in advance for you help.

Tammi

2. upload/download conflict resolvers

3. Dumb SQL Question (OOPS)

4. SQL - Select into a curs

5. (Not so) Dumb sql question

6. Cut, Copy and Paste in the menu bar

7. Dumb sql question

8. Parameterised queries need help

9. dumb sql question

10. dumb sql question (fwd)

11. dumb dumb dumb

12. SQL Server for Access 2000 (here's another dumb blonde question from me)

13. Dumb ASP/SQL Question by newbie