SQL in asp

  • Thread starter Christopher Brandsdal
  • Start date
C

Christopher Brandsdal

I have problem with a sql query..

My query looks like this:

strSql = "SELECT Topic.name, Topic.topic_id, [Topic].[level],
Topic.content_type_id, Topic.visible, Topic.external_link,
Topic.more_content, Topic.content_link, Topic.list_link,
Content_Type.admin_file_name, content_Type.description ";
strSql += "FROM content_Type RIGHT JOIN Topic ON
content_Type.content_type_id = Topic.content_type_id "
strSql += "ORDER BY Topic.hierarchy;";


But what I want to do is join in a secound table called ''menu''.
The 2 fields I want to join in is ''menu.topic_id'' and ''menu.language_id''

How can I join them in the same FROM query like this: menu.topic_id =
Topic.topic_id


If I understand tis right, I have to use two joins in the same FROM
sentence?


Christopher Brandsdal
 
J

Jeff Cochran

I have problem with a sql query..

My query looks like this:

You should always specify the database or language, since some Access
SQL statments won't work in MS-SQL Server and vice versa. And Oracle
always bites me on syntax. :)
strSql = "SELECT Topic.name, Topic.topic_id, [Topic].[level],
Topic.content_type_id, Topic.visible, Topic.external_link,
Topic.more_content, Topic.content_link, Topic.list_link,
Content_Type.admin_file_name, content_Type.description ";
strSql += "FROM content_Type RIGHT JOIN Topic ON
content_Type.content_type_id = Topic.content_type_id "
strSql += "ORDER BY Topic.hierarchy;";


But what I want to do is join in a secound table called ''menu''.
The 2 fields I want to join in is ''menu.topic_id'' and ''menu.language_id''

How can I join them in the same FROM query like this: menu.topic_id =
Topic.topic_id


If I understand tis right, I have to use two joins in the same FROM
sentence?

Unless I miss what you're doing, wouldn't an implicit JOIN and a WHERE
clause work on this? Something like:

SELECT Topic.name, Topic.topic_id,
[Topic].[level],Topic.content_type_id, Topic.visible,
Topic.external_link,Topic.more_content, Topic.content_link,
Topic.list_link,Content_Type.admin_file_name,
content_Type.description,menu.topic_id,menu.language_id
FROM Topic, content_Type, menu WHERE content_Type.content_type_id =
Topic.content_type_id AND menu.topic_id =Topic.topic_id
ORDER BY Topic.hierarchy

Jeff
 
U

UncleWobbly

as an aside...
strSql += "ORDER BY Topic.hierarchy;";

what sort of syntax is this? (+=)

I have not seen this before but it fails on my asp rig here. I suspect I
might be barking up the wrong tree here coz the ";" at the end of the line
suggests it is SQL syntax...
 
B

Bob Lehmann

He's using JScript.

Bob Lehmann

UncleWobbly said:
as an aside...


what sort of syntax is this? (+=)

I have not seen this before but it fails on my asp rig here. I suspect I
might be barking up the wrong tree here coz the ";" at the end of the line
suggests it is SQL syntax...
 
W

William Morris

"+=" is javascript, among other things, and serves the same purpose as
"strSQL = strSQL & ". The semi-colon is also javascript, and is wholly
unnecessary when writing in that language except to separate statements on
the same line.
 
E

Evertjan.

William Morris wrote on 23 jan 2004 in
microsoft.public.inetserver.asp.general:
The semi-colon is also javascript, and is wholly
unnecessary when writing in that language except to separate
statements on the same line.

Also very useful helping you all to recognize the OP code was jscript.

;-}
 
U

UncleWobbly

ah right... thanks... silly me, when it said asp in the title I jumped to
conclusions...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top