Hi there,
i have a project vb6. i want using inner join to join 4 tables with query select. but it's error "The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect..
This is my script - QuerySelect = "SELECT a.DN, b.DIN, c.PIN, c.UserName, " _
-
& "b.Clock, d.ItemName, " _
-
& "FROM ras_Device a INNER JOIN ras_AttRecord b ON a.DN = b.DN " _
-
& "LEFT JOIN ras_Users c ON b.DIN = c.DIN " _
-
& "LEFT JOIN ras_AttTypeItem d ON d.ItemId = b.AttTypeId " _
-
& "WHERE b.DIN = c.DIN"
-
rsSQL.Open QuerySelect, adoRAS
Please help me.
Thanx before.
Regards,
Octo
database use ms.access 2003
6 6750
Hi
First thing to do is remove the comma between d.ItemName and the FROM. I think it is expecting FROM to be a field name, which is, of course, a reserved word!?
MTB
Thanx Mr.Mike,
I have fixed the script, but is still error,
"Syntax error(missing operator) in query expression 'a.DN=b.DN LEFT JOIN ras_Users c ON b.DIN=c.DIN LEFT JOIN ras_AttTypeItem d ON b.AttTypeId=d.ItemId' :(
Hi
It is a bit difficult to have any degree of confidence in diagnosing the problem without any knoledge of the database structure or what you are trying to achieve, but I suggest some bracketing might be usfeul ! - QuerySelect = "SELECT a.DN, b.DIN, c.PIN, c.UserName, " _
-
& "b.Clock, d.ItemName " _
-
& "FROM ((ras_Device a INNER JOIN ras_AttRecord b ON a.DN = b.DN) " _
-
& "LEFT JOIN ras_Users c ON b.DIN = c.DIN) " _
-
& "LEFT JOIN ras_AttTypeItem d ON d.ItemId = b.AttTypeId " _
-
& "WHERE b.DIN = c.DIN"
??
MTB
Thanx so much Mr.Mike, it work, the desired data has emerged,
now, i have a new question , from the previous SELECT query I want to enter back into the database with INSERT query, but every time I run the application, the old data is still in, I just want the new data are entered
QuerySelect = "SELECT a.DN, b.DIN, c.PIN, c.UserName, " & _
"b.Clock, d.ItemName " & _
"FROM ((ras_Device a INNER JOIN ras_AttRecord b ON a.DN=b.DN) " & _
"LEFT JOIN ras_Users c ON b.DIN=c.DIN) " & _
"LEFT JOIN ras_AttTypeItem d ON b.AttTypeId=d.ItemId " & _
"WHERE b.DIN=c.DIN"
rsSQL.Open QuerySelect, adoRAS
'Input pada dbSIKawan
Do While Not rsSQL.EOF
QueryInsertSIKawan = "INSERT INTO fingerprint_" _
& "(device, finger_ID, nik_kary, nama_kary, time, type)"
QueryInsertSIKawan = QueryInsertSIKawan & " VALUES('" & rsSQL(0) & "', '" & rsSQL(1) & "', " _
& "'" & rsSQL(2) & "', '" & rsSQL(3) & "', '" & rsSQL(4) & "', '" & rsSQL(5) & "')"
adoSIKawan.Execute QueryInsertSIKawan
Loop
any suggestion sir?
Regards,
octo
Hi
Do you get any error messages when the code executes?
What data types are the device, finger_ID, nik_kary, nama_kary, time and type fields?
If any of them are not Text data types then the sytax is incorrect. Number datatypes do not require apostrophy delimiters and date/time fields need # delimiters .
MTB
No sir, but when running the data is always repeating itself, but a similar data entry of repetitive,
ms.access
device = number
finger_ID = number
nik_kary = text
nama_kary = text
time = date / time
type = text
sql server
device = int
finger_ID = int
nik_kary = varchar
nama_kary = varchar
time = datetime
type = varchar
Regards,
Octo
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Barry Young |
last post by:
I am using Access to create a SQL query. It creates an Inner Join Query. I cut and paste the query into PL-SQL. When I try to execute the query I get an error.
ORA 933 SQL command not properly...
|
by: jason.evans |
last post by:
Hi there.
I am having an intrigueing problem.
I have a query which left joins another query to itself twice. The
original query is derived from a linked table in SQLServer 2000.
When I run...
|
by: Nathan |
last post by:
I have an application that uses an Access database to
gather information on students' test scores. In the
database there are three tables which are joined by one-
to-many relationships: ...
|
by: dmonroe |
last post by:
hi group --
Im having a nested inner join problem with an Access SQl
statement/Query design. Im running the query from ASP and not usng the
access interface at all. Here's the tables:
...
|
by: MP |
last post by:
Hi
trying to begin to learn database using vb6, ado/adox, mdb format, sql
(not using access...just mdb format via ado)
i need to group the values of multiple fields
- get their possible...
| |
by: Christian Muenscher |
last post by:
Dear group!
The following statement gives me a resultset containing two columns
containing a PersonID:
SELECT *
FROM A
LEFT JOIN B ON A.PersonID=B.PersonID
UNION SELECT *
FROM A
|
by: chaitanya02 |
last post by:
I have problem joining four tables using Inner Join in ACCESS DB,
I want to join 4 tables: 1, 2, 3 , 4 ....and query data in all these to see, i get a right url associated.
sql1-account id,...
|
by: Chamnap |
last post by:
Hello, everyone
I have one question about the standard join and inner join, which one
is faster and more reliable? Can you recommend me to use? Please,
explain me...
Thanks
Chamnap
|
by: cjakeman |
last post by:
Hi,
Solved a little mystery yesterday when I built a form that combined 2
tables with a 1:M relationship and relational integrity. All the
correct data was visible on the form but, if I tried to...
|
by: YZXIA |
last post by:
Is there any difference between explicit inner join and implicit
inner join
Example of an explicit inner join:
SELECT *
FROM employee
INNER JOIN department
ON employee.DepartmentID =...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |