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(attendanc e.staffid) AS Work
FROM attendance
INNER JOIN staff ON ' at line 10
2 1062
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
user presses the login-button (I can't change that setup).
If the login is not correct I want to display the login form again and
show an additional line displaying the error, that is easy and already
working.
|
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 order such that I get a bunch a foreign key
constraints.
Even if I use the MysqlPhp admin tool, Mysql Manager, SqlYog, it doesn't
work: they make an export of the db structure but the db structure, that
consists of create table statements, isn't...
|
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?
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not...
|
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 of good examples I came up
with the idea of solving the puzzle explained in code below, with the solver
optimized so that a state is never analysed more than once.
However, I soon realized that this could be done most naturally (for me, at...
|
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 name="a">
<input type=text name="b">
</div>
| |
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 can't tell where a
bracket is missing.... a few weeks have past, I requested a feature for the
delphi ide/editor "automatic identation of code in begin/end statements etc"
and today when I woke up I suddenly released a very simple solution for this...
|
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:
http://www.johnjsal.devisland.net/switches.jpg
Here's the situation: Each of the four rows in the diagram is considered
a single 'panel'. Each panel has eight 'switches', which are composed of
two columns each, and these columns have a total of 20...
|
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 there a correct way?
Thanks for the help.
|
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 doing something
was really inefficient and could reduce 10 lines of code with 2, etc.
For reading, I am using a TcpClient and I call
NetworkStream ns = client.GetStream(); to get a stream
stream.Read(buffer, 0, buffer.Length);
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |