473,714 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

this sql command make me sick

hello everyone...

after several days trying to find the right command.. i have to ask you
people...

this is the deal:

i have two tables related...
the first one is the master, the second the slave...
the first has fields like code, name, department and periodicity of
payment...
the second has the payment data... code, date of payment, amount to
pay...

not every one in the first table has the payment in the same month...
because a few people receives its pay one time in the month, and other
receives payment every two or three months (periodicity of payment)...

my trouble is when i want to see all the payments in one month of the
people from one specific department, because if somebody doesn't get
his payment (different periodicity) i have to see the code and name of
the worker AND the date and amount of payment in blank (in that
case)...

i thing that i must to be a simple LEFT JOIN but it doesn't work in
Access (i have a web asp page with and access database in this case)...

i don't know what to do.. please.. if somebody has some ideas.. i need
it...

thanks..

Enzo..

ps/.. my left join code:
SELECT table1.name, table2.date, table2.amount
FROM table1 LEFT JOIN table2 ON table1.code = table2.code
WHERE (((table1.depar tm)=53) AND ((table2.date)= #2/15/2006#));

Jun 1 '06 #1
3 1522
enzo wrote:
hello everyone...

after several days trying to find the right command.. i have to ask you
people...

this is the deal:

i have two tables related...
the first one is the master, the second the slave...
the first has fields like code, name, department and periodicity of
payment...
the second has the payment data... code, date of payment, amount to
pay...

not every one in the first table has the payment in the same month...
because a few people receives its pay one time in the month, and other
receives payment every two or three months (periodicity of payment)...

my trouble is when i want to see all the payments in one month of the
people from one specific department, because if somebody doesn't get
his payment (different periodicity) i have to see the code and name of
the worker AND the date and amount of payment in blank (in that
case)...

i thing that i must to be a simple LEFT JOIN but it doesn't work in
Access (i have a web asp page with and access database in this case)...

i don't know what to do.. please.. if somebody has some ideas.. i need
it...

thanks..

Enzo..

ps/.. my left join code:
SELECT table1.name, table2.date, table2.amount
FROM table1 LEFT JOIN table2 ON table1.code = table2.code
WHERE (((table1.depar tm)=53) AND ((table2.date)= #2/15/2006#));


You are asking an Access question in a SQL Server forum. Access <> SQL
Server.

The following is untested but try it out:

....
FROM table1
LEFT JOIN table2
ON table1.code = table2.code
AND table2.date=#2/15/2006#
WHERE table1.departm= 53 ;

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/m...S,SQL.90).aspx
--

Jun 1 '06 #2
On 1 Jun 2006 15:54:27 -0700, enzo wrote:

(snip)
i thing that i must to be a simple LEFT JOIN but it doesn't work in
Access (i have a web asp page with and access database in this case)...
Hi enzo,

You have asked your question in a SQL Server group. Since you are using
Access, maybe you should try an Access group instead?
ps/.. my left join code:
SELECT table1.name, table2.date, table2.amount
FROM table1 LEFT JOIN table2 ON table1.code = table2.code
WHERE (((table1.depar tm)=53) AND ((table2.date)= #2/15/2006#));


For SQL Server, you'd have to change the format for the date constant.
And for each database that supports LEFT JOIN, you'd have to move the
filtering condition for table2.date.

In SQL Server syntax:

SELECT t1.name, t2.date, t2.amount
FROM table1 AS t1
LEFT JOIN table2 AS t2
ON t2.code = t1.code
AND t2.date = '20060215'
WHERE t1.departm = 53

--
Hugo Kornelis, SQL Server MVP
Jun 1 '06 #3
thanks to both of you...

i'm sorry.. it was my mistake to be here.. sorry again..
anyway thanks for the tip.. i will try it...

thanks,

Enzo.

Jun 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1250
by: adfgvx | last post by:
I am looking for a Compiled version of the Sick extension for Python (Windows XP and Python 2.2). Does anyone have one and send it to me ? Thanking you by advance, Bruno
6
1669
by: Michael | last post by:
Hi, I'm fairly new at Python, and have the following code that works but isn't very concise, is there a better way of writing it?? It seems much more lengthy than python code i have read..... :-) (takes a C++ block and extracts the namespaces from it) def ExtractNamespaces(data): print("Extracting Namespaces")
32
1713
by: Martin Vorbrodt | last post by:
Hi there. Is this code portable between platforms? Is it also 100% standard compliant? #include <iostream> using namespace std; class Point { public: enum COORDS { X = 0, Y, Z }; Point(int x, int y, int z) : _x(x), _y(y), _z(z) {}
27
2352
by: geskerrett | last post by:
I am hoping someone can help me solve a bit of a puzzle. We are working on a data file reader and extraction tool for an old MS-DOS accounting system dating back to the mid 80's. In the data files, the text information is stored in clearly readable ASCII text, so I am comfortable that this file isn't EBCIDIC, however, the some of the numbers are stored in a format that we can't seem to recognize or unpack using the standard python...
6
22909
by: allenj | last post by:
DB21085I Instance "md" uses "32" bits and DB2 code release "SQL08012" with level identifier "02030106". Informational tokens are "DB2 v8.1.0.16", "s030508", "MI00048", and FixPak "2". Product is installed at "/opt/IBM/db2/V8.1". Red Hat AS -------------------------------- what does this error mean? SQL Error Code -443, SQL State 38553, Routine "SYSIBM.SQLCOLUMNS"
15
3910
by: phillip.s.powell | last post by:
<style> div div table tr td a.navbar, div div table tr td font {display: none;} </style> <div class="navigationbar" style="background-color:Black; position: absolute; left:50%; top:127px; margin-left: -400px; width: 800px; height: 26px"> <!-- CODE GOES HERE --> </div>
2
1255
by: enzo | last post by:
hello everyone... after several days trying to find the right command.. i have to ask you people... this is the deal:
14
2859
by: ThazKool | last post by:
I want to see if this code works the way it should on a Big-Endian system. Also if anyone has any ideas on how determine this at compile-time so that I use the right decoding or encoding functions, I would greatly appreciate the help. Thanks, Ché #include <iostream>
0
878
by: coldboyqn | last post by:
Hi you guy! I am using Visual Web Express 2008 to design a server controls (a component). The control is almost very simple. protected override void RenderContents(HtmlTextWriter writer) { base.RenderContents(writer); XElement span = new XElement("span", new XAttribute("style", "color: #FFF000; font-size: 20pt;"), "normal text",
0
8801
marktang
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...
0
8707
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,...
0
9314
Oralloy
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...
1
9074
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9015
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7953
agi2029
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...
1
6634
isladogs
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...
0
5947
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2110
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.