How To Write Sql Statement That Join 3 Tables
i have this code that join 2 tables, Reservation and Customer. Next, i wanted to add another table, Staf to get the name of staf that responsibled on a particular reservation. there is a field name staffCode (FK at Reservation table, PK at Staf table) at the Reservation table. Code:
View Replies
ADVERTISEMENT
I've got three tables:
tblEvent
--------
Id (PK) | Event_Name
tblDelegate
--------
Id (PK) | Delegate_Name
tblBooking
--------
Id (PK) | Event_Id (FK) | Delegate_Id (FK)
I need to retrieve a recordset with the following information:
Booking Id | Event_Name | Delegate_Name
Can anyone see how to do a SELECT statement to do this?
View Replies
View Related
strSQL = "SELECT x.CountryId, x.CountryName, y.SiteId, y.SiteName, z.LocationId, z.Level FROM TableCountry AS x"
strSQL = strSQL & " INNER JOIN TableSite AS y ON (x.CountryId = y.CountryId)"
strSQL = strSQL & " INNER JOIN TableLocation AS z ON (y.SiteId = z.SiteId)"
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression '(x.CountryId = y.CountryId) INNER JOIN TableLocation AS z ON (y.SiteId = z.SiteId)'.
/system1.asp, line 21
View Replies
View Related
I have a MSAccess 2000 mdb where 2 tables must be connected with a fieldname "book_spoke".
This is what I have so far. Is it right? The purpose is to find within the search result all the book_spoke s and link with the proper url for each book_spoke. Code:
View Replies
View Related
I have an access database called employment.mdb The fields that I have in this database are:
Company, Location, Dates, Position, Signing, and Duties.
The problem I am having, I can go in and create a Drop Down pulling information from the Company field, but I can not get the information from the rest of the fields to
populate. I want the Database column values to change when I select a different company.
I will be honest, my only experience with it has been thru Frontpage, I can go in and create a drop down, but get errors if I try to add other database connections into that query. I have enough experience at working with html, but not the asp side of it. I would really appreciate some help with this.
View Replies
View Related
I have a question about JOIN'ed table in Access. I have 2 tables in my database with one being tbl_Events and the other tbl_VolunteerSchedule. tbl_Events contains information regarding upcoming Events. tbl_VolunteerSchedule contains the names of Volunteers plus information from tbl_Events pertaining to the event the volunteer is volunteering for.
What I need is for tbl_Volunteer to Update when I make changes to the Events in tbl_Events. I thought that it was working correctly when I used a LEFT JOIN. However if I make updates to tbl_Events it adding additional record to tbl_Volunteer. It should only Update tbl_VolunteerSchedule when the fields EventID match. Does this make sense? Code:
View Replies
View Related
how do i join tables in access and how do i get asp to output information from two separate tables that have the same primary key?
View Replies
View Related
Currently have
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT [firstname], [lastname], [homepage], [aim], [location], [interests], [email] FROM tblUsers WHERE ID =" & userID
need to use session variable but need to select records form another table based on the logged in user (session variable) Code:
View Replies
View Related
I have some code I need modified and I can't seem to figure it out. Here's the section of code I need to change: ....
View Replies
View Related
I've two tables:
First Table Player
tbl_player (fld_id, fld_dor, fld_tname, fld_tpass, fld_name, fld_email, fld_mobile)
Second Table Attempt
tbl_attempt (fld_attempt_id, fld_dop, fld_tname, fld_pid, fld_pscore)
Relation of First Table with Second Table is fld_tname and fld_pid of tbl_attempt with fld_id of tbl_player
Basically this is a 2-player game in which tbl_player contains both player a and player b details (they are identified by same Team Name). Table Attempt (tbl_attempt) holds individual scores which again can be grouped as a team score by the field fld_tname. Code:
View Replies
View Related
What am I doing wrong in this statement?
SELECT * FROM hebbooktable INNER JOIN hebrewbibletable ON hebbooktable.book = hebrewbibletable.book WHERE text_data LIKE '%bra%' ORDER BY id ASC
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
View Replies
View Related
I'm connecting to my database like so:
Set objRecordset = Server.CreateObject("ADODB.Connection")
objRecordset.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE = " & Server.MapPath("calendar.mdb")
objRecordset.Open
Code:
View Replies
View Related
What am I doing wrong in this statement?Code:
SELECT * FROM hebbooktable INNER JOIN hebrewbibletable ON hebbooktable.book = hebrewbibletable.book WHERE text_data LIKE '%bra%' ORDER BY id ASC
Quote:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
View Replies
View Related
I am currently having a problem with one of my ASP pages; Currently, in the SELECT, I am using JOIN LEFT functions which work fine (see the code below). However, I have now created a new table which I have successfully linked to the other tables.
However, I am not sure how I would word the JOIN LEFT statement for the new table.
The new table is located at Report.Report I have tried to have a go, but am I missing something? I always get an error message saying, Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] Syntax error in JOIN operation. Code:
View Replies
View Related
i am modifying a vbscript quiz. the way the quiz is laid out, each quiz has a little 10 line script that refers to the workhorse file that carries out all of the actions.
in order to make a database connection, i needed to have the script write to a single table. i would like to the script to select the appropriate table to write depending upon which quiz the student takes. Code:
View Replies
View Related
I have about 40 thumbnail images that I want to display on a page with a border to the left. The location of the images is stored in a database. The images are 80 x 20 in size. I got this far with the code: Code:
View Replies
View Related
I need some help with a SQL statement. I currently have which works:
strSQL = "SELECT * FROM mstJobs WHERE JobStatus = True"
I need to query against a second table but I am not sure of the
correct syntax of the statement for adding another table.. somthing
like this i would imagine... ????
strSQL = "SELECT * FROM mstJobs.pmdata WHERE JobStatus = True AND
WHERE WeekEnding IN tblSuperInput.pmdata = strThursday"
View Replies
View Related
I have a table called products, which has the fields productid, productname, description, unitprice, and etc.
I have a list of product ids like productid1, productid2, ..., how can I use sql to build another table called featured products which only holds the productids from the list?
View Replies
View Related
Trying to do a dynamic list box. I have to use response.write to create it since the number of option values changes. Im trying to make it so when you select something the onchange submits the form to retotal all the values on the page.
Problem Im running into is the if statement to keep the selected value and have it selected after the form submits and reloads. Not going to another page just a general submit.
I have this working on other pages just not with the response.write that is created the list box. Code is below. Im getting a Syntax error on the line with the if then on the option value. Any ideas ? Code:
View Replies
View Related
If getting an End of statement error. I know it's something I'm missing and my lack of ASP isn't helping.
Response.Write "<option value='Admin_Game_List.asp?TS=League&LeagueID=" & objRsLeague("ID") & "'>" & objRsLeague("LeagueName") & "</option>"
View Replies
View Related
I need to write a reponse.write statement of the following:
<A HREF="default.htm">Click Here to try again</A>
However, I am not clear about the syntax to handle this.
View Replies
View Related
i want to increase my session time so that it does not expire till the user closes the site.
i have written in global.asa file the following code:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Session_OnStart
Session.Timeout = -1
End Sub
</script>
but it doesnt work and my sesion still expires.
View Replies
View Related
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
I am trying to create a record set using data from two tables. I am using the following code-
Dim objRS
oracleConnection.CommandText = "SELECT CONTACT.CONT_FNAME, LOGIN.LOGN_USER_EMAIL " &_
"FROM CONTACT INNER JOIN LOGIN ON CONTACT.LOGN_ID= LOGIN.LOGN_ID WHERE CONTACT.CONT_ID LIKE 3"
oracleConnection.CommandType = adCmdText
Set objRS = oracleConnection.Execute
Set oracleConnection = Nothing
While Not objRS.EOF
Response.Write objRS("CONT_FNAME") & " " & objRS("LOGN_USER_EMAIL")
objRS.MoveNext
Wend
I am getting an error at the line
Set objRS = oracleConnection.Execute
The error is
SQL command not properly ended
View Replies
View Related
I have three tables in the DB MySQL:
TABLE_V = id, codebar, description
TABLE_C = id, codeplu, description
TABLE_M = id, internalcode, description
In the tables TABLE_V and TABLE_M for each record the descriptions are the same, Is different in the table TABLE_C.
Relations in the tables:
TABLE_V.CODEBAR ===> TABLE_C.CODEPLU
TABLE_V.DESCRIPTION ===> TABLE_M.DESCRIPTION
TABLE_C.CODEPLU ===> TABLE_M.INTERNALCODE
I must query INNER JOIN into three tables to extract CODES and corresponding DESCRIPTIONS, its possible ?
View Replies
View Related
I can't seem to get the syntax right for an inner join statement, its based on one main table and two linked tables,
From Employee inner join((Department ON Employee.Department_Code=Department.Department_Cod e) Location ON Employee.Location_Code=Location.Location_Code)
or something to that effect. Employee is the main table and Dept,Location contain all dept/location codes+descriptions.I'm sure its pretty simple just can't get it right.
View Replies
View Related
I have 2 tables I want use join to use their data its working but it will return twice of each record.
this:
strSQL = "SELECT Foods.*,SeFoods.* From Foods INNER JOIN SeFoods ON Foods.food_id = SeFoods.food_id WHERE SeFoods.type = 1 ORDER BY seFoods.sf_id DESC;" .....
View Replies
View Related
I need to insert simple SQL Queries (joins) in an ASP page.
Select Count (*) from
Fileindexqueue Q,
Domains D,
Files F
Where D.ID = Q.DOMAINID
and Q.FILEID = F.ID
and D.NAME = 'GAINS_GTN'
My ASP code where queries can be inserted looks somewhat like this:
strSQL = "SELECT COUNT(*) AS COUNTOF FROM FILEINDEXQUEUE where (SERVERFLAG = 'Failed')"
objRec.Open strSQL, objConn, adOpenForwardOnly, adLockReadOnly, adCmdText
Response.Write "<P Class=""clsMono"">Files Failed   : <b>" & objRec("COUNTOF") & "</b>"
objRec.Close ...
View Replies
View Related
in this code, Code:
strSql = "SELECT tblClippings.fldClippingID, tblTopics.fldTopicName, tblMessages.fldMessageID, tblMessages.fldMessageTitle, tblMessages.fldMessageCreated, tblPeople.fldPersonDisplayName, tblMessages.fldTopicID FROM tblTopics.fldTopicID INNER JOIN (tblPeople INNER JOIN (tblClippings INNER JOIN tblMessages tblClippings.fldB_MessageID = tblMessages.fldMessageID) ON tblPeople.fldMemberID = tblMessages.fldPersonID) ON tblTopics.fldTopicID = tblMessages.fldTopicID WHERE (tblClippings.fldB_MemberID=" & iPersonID & ")"
after the FROM statement, I am getting confused. It gives error message. I think the problem is just about here,
FROM tblTopics.fldTopicID INNER JOIN (tblPeople INNER JOIN (tblClippings INNER JOIN tblMessages tblClippings.fldB_MessageID =
View Replies
View Related
I am in the process of creating an ASP application to read a SQL Database. I
have imported the database from an Access Database. The Database holds
Client details, such as Agent Name, Address, Telephone. etc. in a table
called Client Code:
View Replies
View Related
I have been racking my brain with this and I just can't seem to figure it out. Here is what I am trying to do. I have 3 tables named Registration, Events, and Customer.
I want to produce a page that lists all events and the number of attendees and who is attending each event. I assume that the only way to do this is by using an inner join and I am having a hard time grasping it.
My registration page has three fields
(customernumber,eventid,eventdate)
My events page has five fields
(eventid,eventdate,place,description,numberofattendees)
and my customer table has three fields that I need to use
(firstname,middlename,lastname,customernumber)
View Replies
View Related
<!--#Include Virtual="/bug/adovbs.inc"-->
<title>Bug Status Board</title>
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog =
techsupportBT; User Id = sa; Password="
Set rs = server.CreateObject("ADODB.Recordset")
sSQL="SELECT T.BugIndex, T.[Date Entered], T.DESCRIPTION,"
sSQL= ssql &" T.Company, T.Technician, T.Developer, T.PROGRAM, "
sSQL= ssql &" T.Status, T.PRIORITY, T.[Version Fix], n.noc"
sSQL= ssql &"FROM TSHIGHISSUES INNER JOIN noc ON T.BugIndex =
n.bugindex "
set rs=conn.Execute(ssql)
and this is the error message that I get Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
Incorrect syntax near the keyword 'INNER'
I cannot find an example anywhere that helps with this situation. This works fine in SQL, but for some reason asp is being a pain.
View Replies
View Related