This following is my code - SELECT staff.staffid,
-
staff.name,
-
attendance.checkintime,
-
attendance.checkouttime,
-
attendance.breakintime,
-
attendance.breakouttime,
-
attendance.latetime,
-
attendance.overtime,
-
attendance.transfees,
-
COUNT (paidvacation.staffid) AS Leave,
-
COUNT(attendance.staffid) AS Work
-
FROM attendance
-
INNER JOIN staff ON (staff.staffid = attendance.staffid)
-
INNER JOIN paidvacation ON (paidvacation.staffid = attendance.staffid)
-
WHERE (attendance.createdate>='$startdate' AND attendance.createdate<='$lastdate') GROUP BY attendance.staffid;
ERROR formed
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Leave,
COUNT(attendance.staffid) AS Work
FROM attendance
INNER JOIN staff ON ' at line 10
2 1056
seems to be that you have extra space between - COUNT (paidvacation.staffid)
count and open braces remove it and check, - SELECT staff.staffid,staff.name,attendance.checkintime,attendance.checkouttime,attendance.breakintime,attendance.breakouttime,
-
attendance.latetime,attendance.overtime,attendance.transfees,COUNT(paidvacation.staffid) AS Leave,COUNT(attendance.staffid) AS Work
-
FROM attendance INNER JOIN staff ON (staff.staffid = attendance.staffid) INNER JOIN paidvacation ON (paidvacation.staffid = attendance.staffid)
-
WHERE (attendance.createdate>='$startdate' AND attendance.createdate<='$lastdate') GROUP BY attendance.staffid;
Luuk 1,047
Recognized Expert Top Contributor
the problem is that LEAVE is a reserved word
Because of this it should not be used as an alias, or you should put double quotes around it: - [root@test]> select 1 Leave;
-
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Leave' at line 1
-
[root@test]> select 1 "Leave";
-
+-------+
-
| Leave |
-
+-------+
-
| 1 |
-
+-------+
-
1 row in set (0.00 sec)
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Joe Randstein |
last post by:
Hi!
I need the best way to solve a problem, I'm a newbie.
I have "login.php", a login script. That page first displays a login
form with itself as target of a post-request to validate data when...
|
by: Eddie Post |
last post by:
Hellu,
I want to transfer the structure of my InnoDb database to another mysql
server 3.23.
However, I don't seem to get this to work correctly as the tables are not
transfered in the correct...
|
by: BVM |
last post by:
Hi, All:
I have this error. It seems execution time is too long. Actually the execution time is about 30 seconds(I tested in Query analyzer). How do I solve this problem?
...
|
by: Alf P. Steinbach |
last post by:
I'm writing a little piece on pointers, to be "bundled" with my attempted
correct C++ tutorial (see FAQ item 29.20, yes, I've finally started to at
least think about that again), and while thinking...
|
by: eric.nave |
last post by:
What is the correct way to find all the form elements in a particular
div? I'd like to be able to loop through them and disable them. For
example:
<form>
<div id="div1">
<input type=text...
| |
by: Skybuck Flying |
last post by:
Sometime ago on the comp.lang.c, I saw a teacher's post asking why C
compilers produce so many error messages as soon as a closing bracket is
missing. The response was simply because the compiler...
|
by: John Salerno |
last post by:
Ok, here's a problem I've sort of assigned to myself for fun, but it's
turning out to be quite a pain to wrap my mind around. It's from a
puzzle game. It will help if you look at this image:
...
|
by: VMI |
last post by:
What's the correct way of using try...catch in my web application? For
example, if I catch a connection error or something with the DB, how am I
supposed to bubble it up to the web interface?
Is...
|
by: eliss.carmine |
last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first
time using C# at all so I don't know if this is the "right" way to do
it. I've already found out several times the way I was...
|
by: stdvu |
last post by:
What will be the output of the following expression:
((a >> b) ^ c)& d
Where a = 12, b =2, c = 5 and d = 2
Ans ===> 010 (binary form) 2 (decimal form)
|
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |
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: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |