Select From Two Tables Syntax

After selecting from two table like so-

select table1.column, table2.column from table1, table2 ...

What is the correct syntax to access the individual table data? With one table I would normally just use- rs("column").

View Replies


ADVERTISEMENT

SQL Select Syntax

I have a sql query as follows...

Set rs = conn.execute("Select * from Table Where Name Like '%" &String1& "%' AND Name Like '%" &String2& "%' AND Name NOT LIKE '%" &String3& "%' OR Name NOT LIKE '%" &String4& "%' Or Name NOT LIKE '%" &String5& "%' ")

I want to group the qualifiers kinda like this example but I don't know the syntax to do it...

Set rs = conn.execute("Select * from Table Where (Name Like '%" &String1& "%' AND Name Like '%" &String2& "%') AND (Name NOT LIKE '%" &String3& "%' OR Name NOT LIKE '%" &String4& "%' Or Name NOT LIKE '%" &String5& "%') ")

You can see how I want to group the qualifiers. What would be the syantax for doing this?

View Replies View Related

Select From 2 Tables

i need to select data from 2 tables, but this is not working. i've made it 3 different ways.

SQL = "SELECT * FROM pedidos2 INNER JOIN pedidos ON pedidos2.pe2_pedido = pedidos.pe_id WHERE pedidos2.pe2_pedido='" & request("service") & "'"
or
SQL = "SELECT * FROM pedidos as a, pedidos2 as b WHERE a.pe_id=" & request("servico") & " AND b.pe2_pedido=a.pe_id"

the third one is the same as the first but instead of using * i used pedidos.fieldname, etc.

View Replies View Related

Select From Two Tables

i have 2 tables.

table 1 : type_code, name, price
table 2: type_code, name

there is no connection between the two 'name' fields.

i used this:

sql =
"SELECT * FROM table1 LEFT JOIN table2 ON table1.code = table2.code".

My Question is how to display the name field of the first/second table in asp?

View Replies View Related

SELECT Syntax In MySQL

Could anybody tell how this query statement looks like in MySQL syntax?

SELECT (Left(TAB1.Field1,InStr(TAB1.Field1,"-")-1)

I have a field containing Styles such as 1010-10, 1010-20, 5050-40, LS7856-10, 7856, 9090. I need select and group them by the part which is before "-". In Access it was pretty easy but in MySQL syntax error appears.

View Replies View Related

SELECT DISTINCT From Two Tables

I have two table which are related:

table1 holds personellinformation
table2 holds nodeInformation

The nodes in table2 can have a nodeOwner which will then get a recordID from
table1. A person can own multiple nodes.

Now I want to display all nodeowners, but not the duplicates (if they own
multiple nodes).

What would be the SQL syntax for that, using ASP with VB?

I've tried using DISTINCT, but I do also need the NodeID which is always
unique so I still get all duplicates.

View Replies View Related

Select Case Syntax Error

I'm getting a syntax error with a Select Case statement:

Select Case CSng(rs.fields("Field1"))
Case 0
Response.Write "Test1"
Case Is < 0 <<< Syntax Error
Response.Write "Test2"
Case Is > 0 <<< Syntax Error
Response.Write "Test3"
End Select

As far as I can tell the syntax *is* correct. What am I missing?

View Replies View Related

Select Different Fields In Multiple Tables

I have 4 tables first table category (category_id and category name in it)
second table artist (artist_id, category_id, artistname in it)
third table album (id, artist_id, album_title in it)
forth table song (id, album_id, title in it)

I'm selecting category in first page
I'm selecting artist in second page
I'm selecting album in third page

I'm requesting, collecting and posting all id's to the next page.

this is the question!!

How can I read from database

1- category name when I was selected in first page
2- artist name when I was selected in second page
3- album name when I was selected in third page

View Replies View Related

Select Database Then Multiple Tables For Updates

What I want to do I select one database and the set the Rs1, rs2 etc.. like in Vb6 I would set DB then:

Set rs1 = db1.OpenRecordSet("Table1")
Set rs2 = db1.OpenRecordSet("Table2")

etc...

However how do I do this in asp3? Code:

View Replies View Related

Selecting Multiple Tables Using SELECT Statment Problem

I am Trying to use the SQL SELECT Statment to open records from multiple tables into one recordset.

I know the basic syntax of the Select statment but I wanted to know if its possible to recive the table name from the feild or the record that I am readinf from the recordset in any given moment.

To make things more clear, my example:

-Open a connection

SQL = "SELECT * FROM TABLE1,TABLE2 WHERE TABLE1.UserID=" & uid & " And TABLE2.UserID=" & uid

rs.open sql,conn,3,3

while not rs.EOF

-read from record

rs.movenext
wend
rs.close
conn.close

now, in the part that I read from the record, is their any way I can know if that record is from table1 or table2?

View Replies View Related

Creating Dynamic Tables In Dreamweaver To Display Tables

I know how to create dynamic tables in dreamweaver to display fields and records in a table of a database, but in my case I need to create a dynamic table that lists all the tables in the database, then to click on the one i want 2 edit the data in there.

View Replies View Related

Error Using <select></select>

I have written some code which should dynamically build a table which is then populated with questionas and possible answers. The format of the answers will vary ie they may be in the form of a radio button which will be rated from 1-5, checkbox or a selectbox.

The first problem I have is if I do not comment out <select></select> I get an error message saying the page can not be found. when I do take it out I get asp timeout. Code:

View Replies View Related

Where NOT IN ( ) Syntax

Can I use this syntax

Where NOT IN (".....)

in a situation I don't want to select items in the list.

If not what other ways can do that.

View Replies View Related

Syntax Help

I'm just trying to display a user's FIRST name and the FIRST INITIAL of the last name on my asp web page.
This works to displays their "firstName" and "lastName":


Code:
<%=oUsers("firstName")%>&nbsp;<%=oUsers("lastName")%>
But I get a variety of vbscript or asp syntax errors when I try to trim the "lastName" using something like


Code:
<%=oUsers("firstName")%>&nbsp;<%=oUsers(replace(left("lastName",1))%>
How do get this simple task done?

(If it makes any difference, the whole thing is inside html <td></td> tags as part of a table)

View Replies View Related

SQL Syntax

I can't see to find where the syntax is wrong because I can do the query just fine in access but my asp page gets this error

Microsoft JET Database Engine error '80040e14'

Syntax error in INSERT INTO statement.

Here is what the insert looks like when I print it out in the page

INSERT INTO tblusers (username,password,[Timestamp],email) VALUES('testuser', 'c4ca4238a0b923820dcc509a6f75849b', '10/16/2004', 'me@home.com')

Here is the code:

View Replies View Related

SQL Syntax

I am trying to query a database for 2 conditions but I can't get the query to work.
Can anybody see a problem with this line of code?Code:

strQuery="SELECT Count(*) AS intTotal FROM tbl_artists WHERE fld_artist_name = '" & strReqname & "'" "AND fld_user_id ='"& strUsername & "'",objConn,,,adCMDText

objRS.Open strQuery,objConn,,,adCMDText

numRecords = objRS("intTotal")

View Replies View Related

SQL Syntax

I have a textarea and have named it category_One.

I have sent the data in this form on using the POST method

contents_category_One = Request.Form("category_One")

I have then used the following sql statement

sql = "INSERT INTO tableName(Category_One) VALUES ('"& contents_category_One &"');"

If someone inserts ' in the text box, this value is causing a syntax error in the sql statement.

View Replies View Related

SQL Syntax

The WHERE part of my select needs to pull out where the date column is empty. If there isn't a date, it shows NULL in the database (SQL7)."WHERE eligibility_dt <> NULL" doesn't work. what am i forgetting?

View Replies View Related

ASP Syntax

I need help with ASP. when i post data to the database, do the records in my form need to be in the same amount as the database records?

View Replies View Related

Sql Syntax

Would anyone have some syntax for a query (SQL2000) that would return results for records that are over 24 hours old (date field is smallDateTime)?

View Replies View Related

Syntax,JS

I believed that there is a wrong syntax on the window.open line...Can anyone spot it ?
Code:
strLocation = "Sch_As_FollowAct.asp?drvid=" & request("drv") & "&u=" & uday(0)

response.write "<script>" & vbCrLf
response.write "window.open('" & strLocation & "' & ",menubar=1,resizable=1,width=350,height=250");" & vbCrLf
response.write "</script>"

View Replies View Related

If Then Syntax

i am having some trouble rembering the correct syntax for a If Then Statement here is my code.

<% If Request.QueryString("access") = "false" Then %>
<tr>
<td colspan="2" bgcolor="#FFFFFF" class="mediumRed">The User
ID and Password combination has failed.<br> <br>
Please try again.</td>
</tr>
<% Else If rsGettblCouples.Fields.Item("StopDate") = "1/1/1900" Then %>
<tr>
<td colspan="2" bgcolor="FFFFFF" class="mediumRed"> The User has already<br>
completed the online scoring.<br>Please Contact your facilitator.</td>
</tr>
<% End If %>
<% End If %>

View Replies View Related

Syntax 101

Can someone direct me a set of rules for building strings in ASP? I'm always getting stuck on when to use a quote (") or apostrophe{'} or both. This simple string is giving me fits...

Response.Redirect("test3.asp?orderno='" &
(rsProducts.Fields.Item("OrderNo").Value) & "')"

I can't seem to get the right combination.

View Replies View Related

Dsn Less Syntax

What's wrong with the syntax in this connection string? It's a DSN less connection to an Access DB.

<%
Set Conn = Server.CreateObject("ADODB.Connection")
MM_GenKAccess_STRING = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("authors.mdb") & ";" & _
Jet OLEDB:Database Password=48912; & _
Jet OLEDB:System database=" & Server.MapPath("system.mdw") & ";" & _
conn.open MM_GenKAccess_STRING
%>

View Replies View Related

Do While Not - Syntax

I want to update multiple rows in an SQL table. Presently, it's populating all rows with the same data based on the first row. It's not looping through all records one at a time.
Is this the correct syntax.

<%
rsOD 'recordset up here
%>

<%
Dim DataConn1
Set DataConn1 = Server.CreateObject("ADODB.Connection")
DataConn1.Open MMSTRING
Do While Not rsOD.EOF
'SQL UPDATE statement here
DataConn1.Execute(SQL)
rsOD.MoveNext
Loop
%>

View Replies View Related

Syntax Of URL

Can any one tell me why this snippet is not showing the a href correctly. Sorry, not sure of ASP syntax as yet...

Response.Write Highlight(myTextwo, "", "", "<a href=""url.com=" & CInt(rsrch("tablcolumn")) & """ target=""_blank"">" & rsrch("othercolumn")) & "</a>"

View Replies View Related

Syntax ASP

Another slight problem with syntax of asp, basically I'm pulling an image file name from my database (image1.jpg) and using the images directory on my web server to display my picture, make sense? Code:

View Replies View Related

Syntax Err,JS

I believed that there is a wrong syntax on the window.open line. Can anyone spot it?

strLocation = "Sch_As_FollowAct.asp?drvid=" & request("drv") & "&u=" & uday(0)

response.write "<script>" & vbCrLf
response.write "window.open('" & strLocation & "' & ",menubar=1,resizable=1,width=350,height=250");" & vbCrLf
response.write "</script>"

View Replies View Related

SQL Syntax

If you haven't noticed I am novice and have just started getting back into the world of ASP. First question can I have two And statements, and second the syntax is wrong with my And statements where can i find a reference to see the proper syntax. Code:

mySQL= "SELECT tbl_Sch.Schedule_id, tbl_Sch.TeamId, tbl_Sch.GameDate, tbl_Sch.GameDescription, tbl_Sch.GameTime, tbl_Sch.GameStatus, tbl_Sch.Season, tbl_team.TeamID, tbl_team.Team_Name, tbl_team.Enabled" _
& " FROM tbl_team, tbl_Sch " _
& " where tbl_team.TeamID = tbl_Sch.TeamId" _
& " And tbl_team.Enabled = '"-1"' " _
& " And tbl_Sch.Season = '"2005-FAL"' ;"

View Replies View Related

Add Sql Tables

I want to be able to send two sql tables to access db at the same time

View Replies View Related

Update Syntax

I am trying to update my database with hidden fields that are being requested from a previous page such as:

hfSectionOneScore
hfSectionTwoScore
hfSectionThreeScore

I'm not familiar how to write an UPDATE statement, and would like some help. I'm thinking that it is something like this:

UPDATE Director_Appraisals SET

Section1Score = request("hfSectionOneScore"),
Section2Score = request("hfSectionTwoScore"),
Section3Score = request("hfSectionThreeScore"),

WHERE UserID = request("hfUserID");

Of course there are more columns, but am I on the right track? Does the syntax look correct?

View Replies View Related

SQL Syntax Near The = Sign

I am concatenating the firstname and lastname in the SQL query in the ASP page. I get the error:

Syntax error near =

This query works in Access.

<input type=hidden value="<%=strNetworkID%>" name=""networkid">

"SELECT" EmpID, FirstName + ' ' + LastName as Employee_Name, NetworkID FROM Employee WHERE networkID = " & Request.form("networkid")

View Replies View Related

Query Syntax In My Sql

I just decided to leave Mssql and start using Mysql. I am having some problems with my queries; is there anyone here who has a knowledge of query syntax in Mysql?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved