I have a simple query of joined tables that is failing to give me any rows
of data (though, in checking by hand, it certainly should). Essentially, I
am trying to return all rows from `ups` that have `floattime` not equal
to it's default value of '0' (please not, in this db dates and times are
saved as varchars - so essentially I am comparing strings)
SELECT ups.date,associ ates.branch ,associates.use rname ,ups.time
,ups.floattime FROM ups ,associates WHERE
(ups.associatek ey=associates.i d) AND ups.date >='2005-12-05%' AND ups.date
<='2005-12-07%' AND ups.cxl <=0 AND ups.floattime <>'0'
The structure of the two tables is:
CREATE TABLE `ups` (
`id` int(11) NOT NULL auto_increment,
`date` varchar(16) default NULL,
`time` varchar(11) default NULL,
`associatekey` int(11) default NULL,
`floattime` varchar(11) NOT NULL default '0',
PRIMARY KEY (`id`)
)
CREATE TABLE `associates` (
`id` int(11) NOT NULL auto_increment,
`username` varchar(16) NOT NULL default '',
`branch` varchar(30) default NULL,
)
My query returns an empty result set, which I have said is not right. Oddly,
if I eliminate the last phrase of the sql statement, "ups.floatt ime <>'0' "
it runs, returning all rows, but making the joins between the tables
correctly. Then, if I eliminate the need to join the tables (i.e. if I say I
dont want information about the associate) and distill my query down to
SELECT date,time,float time FROM ups WHERE date >='2005-12-05%' AND
date <='2005-12-07%' AND floattime <>'0'
It runs correctly, returning the four correct rows.
2005-12-06 Tue 11:05:29 11:04:27
2005-12-07 Wed 13:59:14 13:58:23
2005-12-07 Wed 14:08:10 14:07:23
2005-12-07 Wed 14:13:30 14:12:33
So I am asking here, how can I construct this query, given the above table
structures, to return information about the associate as I have tried to do
in the initial query? What do I have wrong with that initial query that it
will not return the information I am looking for? TIA, Ike 1 1941
Ike wrote: I have a simple query of joined tables that is failing to give me any rows of data (though, in checking by hand, it certainly should). Essentially, I am trying to return all rows from `ups` that have `floattime` not equal to it's default value of '0' (please not, in this db dates and times are saved as varchars - so essentially I am comparing strings)
SELECT ups.date,associ ates.branch ,associates.use rname ,ups.time ,ups.floattime FROM ups ,associates WHERE (ups.associatek ey=associates.i d) AND ups.date >='2005-12-05%' AND ups.date <='2005-12-07%' AND ups.cxl <=0 AND ups.floattime <>'0'
The structure of the two tables is:
CREATE TABLE `ups` ( `id` int(11) NOT NULL auto_increment, `date` varchar(16) default NULL, `time` varchar(11) default NULL, `associatekey` int(11) default NULL, `floattime` varchar(11) NOT NULL default '0', PRIMARY KEY (`id`) )
CREATE TABLE `associates` ( `id` int(11) NOT NULL auto_increment, `username` varchar(16) NOT NULL default '', `branch` varchar(30) default NULL, )
My query returns an empty result set, which I have said is not right. Oddly, if I eliminate the last phrase of the sql statement, "ups.floatt ime <>'0' " it runs, returning all rows, but making the joins between the tables correctly. Then, if I eliminate the need to join the tables (i.e. if I say I dont want information about the associate) and distill my query down to
SELECT date,time,float time FROM ups WHERE date >='2005-12-05%' AND date <='2005-12-07%' AND floattime <>'0'
It runs correctly, returning the four correct rows.
2005-12-06 Tue 11:05:29 11:04:27 2005-12-07 Wed 13:59:14 13:58:23 2005-12-07 Wed 14:08:10 14:07:23 2005-12-07 Wed 14:13:30 14:12:33
So I am asking here, how can I construct this query, given the above table structures, to return information about the associate as I have tried to do in the initial query? What do I have wrong with that initial query that it will not return the information I am looking for? TIA, Ike
What is ups.cxl? You are using it in the WHERE clause but it
isn't in your CREATE TABLE statement.
Jerry This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ed_No_Spam_Please_Weber |
last post by:
Hello All & Thanks in advance for your help!
Background:
1) tblT_Documents is the primary parent transaction table that has 10
fields and about 250,000 rows
2) There are 9 child tables with each having 3 fields each, their own
PK; the FK back to the parent table; and the unique data for that
table. There is a one to many relation between the parent and each of
the 9 child rows. Each child table has between 100,000 and 300,000
|
by: sqlgoogle |
last post by:
Hi I'm having update problem.
Here is the senario
I have to different db server (SQL Server) linked with each other
In DB Server 1 I have 2 tables &
In DB Server 2 I have 3 tables.
I have joined tables with each other first & then between the servers
When I run select on DB Server1 with both tables joined I'm getting
more values then when I run the select between the DB Servers (about 20
|
by: allyn44 |
last post by:
Hello--I have 2 tables (illness,event) that a need to query and create a recordset
The key fields are personId and description (text field) in each table. I also have other needed
fields in the query but these are the 2 that join the 2 tables. I also have unique id's for each
table (autoID, SeqNum). It runs ok except one issue--I have some unwanted duplicates in the result--
For each ID in either table--the description may not be unique
...
|
by: John Baker |
last post by:
Hi:
I have two tables, a setup table (TblSetup) and a purchase order table (tblPO).
When i construct a query with ONLY the tblPO shown, and a type in parameter for the PO
number, I an update the original tblPO. However, when I introduce the setup file into the
query I cannot update the result. THis is true if I make a link to Setup or not. In fact,
setup contains the client ID, which i wish to test against the client ID in the PO...
|
by: Michael |
last post by:
I have a query that uses two joined tables. The query contains data.
I would like to pull in a data drom another table but when I add that
table to the query design and make the join,the existing data is not
shown in the query in datasheet view. I have realised that this is
because the joined fields in the existing data were not populated to
link to the newly added table. I can understand why data was not
pulled in from the new table...
| |
by: Carl B Davis |
last post by:
Help please!!! I am an intermediate access user that is getting my
bottom kicked by what seems an easy problem to fix. I maintain an
employee database at work. I have set up a query from two tables to
generate a query displaying useful fields, but only for those whom
appear on both tables. The names are formatted different so I chose to
join them using the SSN. I set up the query and joined the SSN
property but when I run the query, it...
|
by: Tom |
last post by:
Using AccessXP in 2000 mode.
I have the following tables ---
TblLocation
LocationID
PropertyID
StateID
CountyID
CityID
|
by: listerofsmeg01 |
last post by:
Hi,
Pretty new to PHP and MySQL.
I have a page on my site that displays a lot of information from
various tables. Currently I have lots of small PHP wrapper functions
around SQL queries to get each bit of information. This results in
maybe 10 queries to display one page, but they are all very small and
simple, and it keeps the PHP looking nice too as they are simple
function calls to get each piece of info, which can be called from any
|
by: racquetballer |
last post by:
I need to to an update query that involves three tables: table Dealer
needs to be updated with data from table Personnel and table Title.
Dealer is joined to Personnel where Dealer.Dealer_Code =
Personnel.so_cd
Personnel is linked to Title by Personnel.name_id = Title.name_id
I need to update fields Principal_First_Name, Principal_Last_Name, and
Company_Email in Dealer from FirstName, LastName, and
InternetEmailAddr in Personnel where...
|
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: 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...
|
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: 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();...
|
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 we have to send another system
| |
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...
| |