I have a view that is joining multiple tables. How do I modify this view so
that it also returns when the value is "NULL" for some of the join table
fields???
Any help would be greatly appreciated!!!
Thank you,
-Valerie
SELECT TOP 100 PERCENT dbo.PATIENTMEDICATION.PatientMedicationID,
dbo.MEDICATION.MedicationDS, dbo.MEDICATION.MedicationID,
dbo.DOSAGEUNIT.DosageUnitDS,
dbo.PATIENTMEDICATION.DosageUnitID, dbo.PATIENTMEDICATION.Dosage,
dbo.DURATIONUNIT.DurationUnitDS,
dbo.PATIENTMEDICATION.DurationUnitID,
dbo.PATIENTMEDICATION.Duration, dbo.PATIENTMEDICATION.BegunDT,
dbo.PATIENTMEDICATION.DiscontinuedDT,
dbo.PATIENTMEDICATION.ActiveYN, dbo.PATIENTMEDICATION.VisitID,
dbo.PATIENTMEDICATION.PatientID
FROM dbo.PATIENTMEDICATION INNER JOIN
dbo.MEDICATION ON dbo.PATIENTMEDICATION.MedicationID =
dbo.MEDICATION.MedicationID INNER JOIN
dbo.DOSAGEUNIT ON dbo.PATIENTMEDICATION.DosageUnitID =
dbo.DOSAGEUNIT.DosageUnitID INNER JOIN
dbo.DURATIONUNIT ON
dbo.PATIENTMEDICATION.DurationUnitID = dbo.DURATIONUNIT.DurationUnitID
ORDER BY dbo.PATIENTMEDICATION.VisitID, dbo.PATIENTMEDICATION.ActiveYN DESC,
dbo.PATIENTMEDICATION.PatientMedicationID 1 1052
Valerie,
Look into using OUTER JOIN instead of INNER JOIN when you want all values
from one table included, even if no matching values are found in the other
table.
Kerry Moorman
"kvrdev1" wrote: I have a view that is joining multiple tables. How do I modify this view so that it also returns when the value is "NULL" for some of the join table fields???
Any help would be greatly appreciated!!! Thank you, -Valerie
SELECT TOP 100 PERCENT dbo.PATIENTMEDICATION.PatientMedicationID, dbo.MEDICATION.MedicationDS, dbo.MEDICATION.MedicationID, dbo.DOSAGEUNIT.DosageUnitDS, dbo.PATIENTMEDICATION.DosageUnitID, dbo.PATIENTMEDICATION.Dosage, dbo.DURATIONUNIT.DurationUnitDS, dbo.PATIENTMEDICATION.DurationUnitID, dbo.PATIENTMEDICATION.Duration, dbo.PATIENTMEDICATION.BegunDT, dbo.PATIENTMEDICATION.DiscontinuedDT, dbo.PATIENTMEDICATION.ActiveYN, dbo.PATIENTMEDICATION.VisitID, dbo.PATIENTMEDICATION.PatientID FROM dbo.PATIENTMEDICATION INNER JOIN dbo.MEDICATION ON dbo.PATIENTMEDICATION.MedicationID = dbo.MEDICATION.MedicationID INNER JOIN dbo.DOSAGEUNIT ON dbo.PATIENTMEDICATION.DosageUnitID = dbo.DOSAGEUNIT.DosageUnitID INNER JOIN dbo.DURATIONUNIT ON dbo.PATIENTMEDICATION.DurationUnitID = dbo.DURATIONUNIT.DurationUnitID ORDER BY dbo.PATIENTMEDICATION.VisitID, dbo.PATIENTMEDICATION.ActiveYN DESC, dbo.PATIENTMEDICATION.PatientMedicationID This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Darren Smith |
last post by:
I am having a great deal of difficulty accessing individual fields
generated from a Sql Server 7 view.
When I specify the actual field name, I get the error:
Microsoft OLE DB Provider for ODBC...
|
by: M. Mehta |
last post by:
It seems that you can not create a materialized view if you are using
outer joins...can someone please verify this?
Thanks
M. Mehta
Please follow my example below:
created 2 tables:
|
by: kackson |
last post by:
Hi.
I created a simple view with the following statements:
CREATE VIEW dbo.VIEW1
AS
SELECT dbo.VIEW_ALL.ID,
dbo.VIEW_ALL.Code,
Another.dbo.OTHER_VIEW.Label as SpecialCode
FROM ...
|
by: brendan_gallagher_2001 |
last post by:
Hi,
I have a view(A) and I am trying to do a join on another table (B) to
include only rows where date values in view A is greater than in table
B. I also want the view to pick up rows in viewA...
|
by: Neil |
last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table
with 50,000 records; and I have a selections table with 50,000 records for
each machine that uses the database (about...
|
by: Beowulf |
last post by:
I have the view below and if I use vwRouteReference as the rowsource
for a combo box in an MS Access form or run "SELECT * FROM
vwRouteReference" in SQL Query Analyzer, the rows don't come through...
|
by: jason.langdale |
last post by:
I have 3 tables I want to use in a view. Table A has field 1,2,3,4,5
and table B has field 1,2,3,4,5. I want to do a union on these. (I have
done so successfully if I stop here) I also want to join...
|
by: Dia |
last post by:
Hi there,
I struggle to get this going i would like to insert data into 2 tmp
tables in a view.
If i run the code on it's own it works perfectly until i want to create
a view it complains...
|
by: Sibongile Khanyile |
last post by:
If anyone can help... I have a function that takes one parameter and
bring back quite a lot of records. but with a conventional function the
field size has a limit of 8000 and i can not use field...
|
by: emanning |
last post by:
I'm having problems using "<>" as criteria for a varchar column in a
view. The data in this column is '2008-2009' which is supposed to
mean year 2008 thru 2009. If I set the criteria to "=...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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: 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: 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,...
| |