Hi,
I hope I can explain this right:
Here is my statement so far: -
SELECT shift_log.note, shift_log.id, shift_log.timestamp, shift_log.monitor, shift_log.handover,
-
shift_log.start_time, shift_log.finish_time, shift_log.sunref, shift_log.hpref, shift_log.hsbcref,
-
CONCAT(users.fname, " ", users.lname) AS users_name, equipment.name AS equipment_name, equipment_id";
-
FROM shift_log, equipment, users, part_usage
-
WHERE equipment.id = shift_log.equipment_id AND shift_log.user = users.id AND part_usage.shift_log_id = shift_log.id
-
ORDER BY shift_log.timestamp DESC
-
The last AND statement (AND part_usage.shift_log_id = shift_log.id) in the where clause is not always true, I want to get the info if its there, but allow the statement to run if there are no records, but im lost as to how to do so. As it is i only get results for those that have an entry in part_usage, but I still want the other rows that have no entry in part_usage. Is this possible?
1 2800
Use a LEFT OUTER JOIN for that.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Adam Nemitoff |
last post by:
Is is possible to construct a SELECT statement that contains a WHERE
clause that uses the value from a column in the "next" row?
ie. given a table with a single field named "myField" with the...
|
by: ghasem |
last post by:
Dear mySQL community,
I have once again turned to the user groups for a problem I cannot
solve myself! Atually, I have read all I can from the newsgroups on
this but I could not solve it myself....
|
by: Rowland Hills |
last post by:
I have a table which is returning inconsistent results when I query
it!
In query analyzer:
If I do "SELECT * FROM TABLE_NAME" I get no rows returned.
If I do "SELECT COL1, COL2 FROM...
|
by: Ian T |
last post by:
Hi,
I've got what I think (probably incorrectly) should be a simple SELECT :
Two colums with data like
col1 col2
1 50
1 51
2 50
|
by: Rowan |
last post by:
Hi there, it has been a while since i have posted. I am in a
situation where I am stumped. I am learning to build a dts package
where I am connecting to a table in an AS400. This database is...
|
by: Toby Austin |
last post by:
I'm trying to replace <table>s with <div>s as much as possible.
However, I can't figure out how to do the following…
<table>
<tr>
<td valign="top" width="100%">some data that will...
|
by: jimh |
last post by:
I'm not a SQL expert. I want to be able to write a stored procedure
that will return 'people who bought this product also bought this...'.
I have a user table that links to a transaction table...
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID ...
|
by: rAinDeEr |
last post by:
Hi,
I have a web application with a table to store terms and
conditions of a Company.
This may some times run into many pages and some times it may be just a
few sentences. It is a character...
|
by: mokazawa1 |
last post by:
Hi,
I'm using stored procedures in DB2 UDB 8.1.2. In this stored, I execute
a select for update command, opening a cursor. Then I update the rows
using fetch and current of. The problem is that...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: 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...
| |