Mismatch query not working. Not sure what I did wrong.
In my query, I have created two CTE's. One pulls in the records of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course.
What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department had
three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. Then, say the IT Department had five people in the audience, and none of them
have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.)
I thought I was doing the mismatch query correctly, but I guess I must not. I will share the relevant parts of my query below (there is more to my query, but I don't think you necessarily need to see it to assist with this particular problem). (Side note:
Yes, I know the way I am doing the fiscal calendar is not ideal, but I've looked up other ways to do it, and do not understand it. Given time, I can break it down and understand it, but I am in a rush to finish this report.)
gm101certtbl
AS
select
dimUser.EmpFK MeasureEmpFK,
RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
audusersName MeasureAudName,
dimActivity.ActivityName MeasureActName,
dimActivity.Code MeasureActCode,
CASE
WHEN OrgCode2 LIKE 'US%' then 'US'
WHEN OrgCode2 LIKE 'CA%' then 'CA' END
CountryCode,
'ACTUALS_GM101' SOURCESYSTEMID,
Null CURRENCYCODE,
'GM101CERT' MEASUREID,
Null MEASUREDOLLARS,
CASE
WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
FiscalYear,
CASE
WHEN MONTH(GETDATE()) = '10' THEN '1'
WHEN MONTH(GETDATE()) = '11' THEN '2'
WHEN MONTH(GETDATE()) = '12' THEN '3'
WHEN MONTH(GETDATE()) = '1' THEN '4'
WHEN MONTH(GETDATE()) = '2' THEN '5'
WHEN MONTH(GETDATE()) = '3' THEN '6'
WHEN MONTH(GETDATE()) = '4' THEN '7'
WHEN MONTH(GETDATE()) = '5' THEN '8'
WHEN MONTH(GETDATE()) = '6' THEN '9'
WHEN MONTH(GETDATE()) = '7' THEN '10'
WHEN MONTH(GETDATE()) = '8' THEN '11'
WHEN MONTH(GETDATE()) = '9' THEN '12' END
FiscalMonthNbr
from
dimUser INNER JOIN
audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
Org ON dimUser.PrimaryDomFK = Org.Org_PK INNER JOIN
factUserRequiredActivity ON factUserRequiredActivity.UserID = dimUser.ID INNER JOIN
dimActivity ON dimActivity.ID = factUserRequiredActivity.ActivityID INNER JOIN
dimRequirementStatus ON factUserRequiredActivity.ReqStatusID = dimRequirementStatus.ID LEFT OUTER JOIN
UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
UsrDoms ON dimUser.ID = UsrDoms.UserID
WHERE
dimActivity.ActivityName = 'GM101 Program Completion'
AND
dimRequirementStatus.name = 'Satisfied'
AND
(audusersName = @audparam)
gm101availtbl
AS
select
dimUser.EmpFK MeasureEmpFK,
RIGHT(OrgCode2, LEN(OrgCode2) - 2) MeasurePC,
audusersName MeasureAudName,
Null MeasureActName,
Null MeasureActCode,
CASE
WHEN OrgCode2 LIKE 'US%' then 'US'
WHEN OrgCode2 LIKE 'CA%' then 'CA' END
CountryCode,
'ACTUALS_GM101' SOURCESYSTEMID,
Null CURRENCYCODE,
'GM101AVAIL' MEASUREID,
Null MEASUREDOLLARS,
CASE
WHEN GETDATE() Between '20131001 00:00:00' AND '20140930 11:59:59' THEN '2014'
WHEN GETDATE() Between '20141001 00:00:00' AND '20150930 11:59:59' THEN '2015'
WHEN GETDATE() Between '20151001 00:00:00' AND '20160930 11:59:59' THEN '2016'
WHEN GETDATE() Between '20161001 00:00:00' AND '20170930 11:59:59' THEN '2017' END
FiscalYear,
CASE
WHEN MONTH(GETDATE()) = '10' THEN '1'
WHEN MONTH(GETDATE()) = '11' THEN '2'
WHEN MONTH(GETDATE()) = '12' THEN '3'
WHEN MONTH(GETDATE()) = '1' THEN '4'
WHEN MONTH(GETDATE()) = '2' THEN '5'
WHEN MONTH(GETDATE()) = '3' THEN '6'
WHEN MONTH(GETDATE()) = '4' THEN '7'
WHEN MONTH(GETDATE()) = '5' THEN '8'
WHEN MONTH(GETDATE()) = '6' THEN '9'
WHEN MONTH(GETDATE()) = '7' THEN '10'
WHEN MONTH(GETDATE()) = '8' THEN '11'
WHEN MONTH(GETDATE()) = '9' THEN '12' END
FiscalMonthNbr
from
dimUser INNER JOIN
audusers ON audusers.DataSetUsers_EmpFK = dimUser.EmpFK INNER JOIN
Org ON dimUser.PrimaryDomFK = Org.Org_PK LEFT OUTER JOIN
UsrOrgs ON dimUser.ID = UsrOrgs.UserID LEFT OUTER JOIN
UsrDoms ON dimUser.ID = UsrDoms.UserID
WHERE
audusersName = @audparam
missingPC
AS
select distinct
NULL MeasureEmpFK,
gm101availtbl.MeasurePC,
gm101availtbl.MeasureAudName,
gm101availtbl.MeasureActName,
gm101availtbl.MeasureActCode,
gm101availtbl.CountryCode,
gm101availtbl.SOURCESYSTEMID,
gm101availtbl.CURRENCYCODE,
'GM101CERT' MEASUREID,
gm101availtbl.MEASUREDOLLARS,
gm101availtbl.FiscalYear,
gm101availtbl.FiscalMonthNbr
from
gm101availtbl LEFT OUTER JOIN
gm101certtbl on gm101certtbl.MeasurePC = gm101availtbl.MeasurePC
WHERE gm101certtbl.MeasurePC IS NULL
If anybody can help, I would greatly appreciate it. I'm trying to do this so I can pull these records into a final table to count the records from the other two, but then include these as a 0 count where these departments have nobody certified.
To test if this was working, I created a query using this Mismatch query instead as the main query. Instead, it seemed to give me the exact opposite. It seemed to be giving me all of the Departments (MeasurePC) where the records were represented.
Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums. We have no sample data, so we cannot even guess.
>> In my query, I have created two CTE's. One pulls in the records [sic] of all people who are assigned to an audience. The other pulls in all people who are assigned to the same audience AND completed a certain course. <<
Please, please learn the basic terms. Rows are not records. And THEN learn what “redundancy” means so you will not write two CTEs in the future.
>> What I wanted to do from there, was to do a mismatch query, not to find the PEOPLE, but just the departments that were represented in the audience, but had no people in the list of those who completed the course. (In other words, say the HR Department
had three people in the audience... two completed the course, one did not. The HR Department should NOT show up in my mismatch query because some of their people completed the course. THEN, say the IT Department had five people in the audience, and none of
them have completed the course. The IT Department SHOULD show up in my mismatch query. For this case, I don't care about the people who didn't complete it, just the departments where nobody did yet.) <<
This is a Relational Division. It is one of Dr. Codd's original 8 operations.
We do not use the Sybase CURRENT_TIMESTAMP any more. We have DATE data types tody, rtoo. We never tibble in good code; it is a design flaw that used meta-data affixes like “tbl” in schema object _names, PK in column _names, etc. We do not have repeated groups
like “org_code_2”; we do not use arrays in RDBMS. Why is your data so screwed up you have use
CASE
WHEN org_code2 LIKE 'US%' THEN 'US'
WHEN org_code2 LIKE 'CA%' THEN 'CA' END
to clean it up in a query; the DDL should have prevented this problem.
Why are you doing calendar computing in your query? Where is the Calendar table?
“Users.id = UsrOrgs.user_id” says that you have magic, generic “id” that can change its name from table to table. Likewise, a generic, magic “code”, etc. What might be even worse is that totally different data elements have the same name! “Automobiles, squids
and Lady Gaga” programming is not RDBMS.
You have never heard of ISO-11179 and data modeling?
Here is a skeleton for fiscal calendar table to replace your current row by row temporal math:
CREATE TABLE Calendar
(cal_date DATE NOT NULL PRIMARY KEY,
fiscal_month CHAR(10) NOT NULL,
INSERT INTO Calendar
VALUES
('2014-10-01', '2015-01-00', ..),
('2014-09-30', '2015-12-00', ..),
You can use a spread sheet and a text edit to fill in the table for 50 or 100 years.
I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601 data format required by Standard SQL and it is
language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Similar Messages
-
Hi there not sure what I did wrong but got a message asking if I would allow the application config but was warned by commputer not to now I can't log into some sites and others won't load properly, some sites will log in but only if the stay logged in box is not checked,I'v have cleared my cashe and internet history looked through securtity setting but nothing, anyone had this problem and has any advice?
See KB Article: http://support.apple.com/kb/HT1274 Changing or resetting an account password
my current country does not have a apple store....
AS are not the only places that repair Macs. Check out the following:
International AASP’s & Other Services
AASP's Outside of the USA
How to find your nearest Apple Authorized Service Provider (AASP)
Also, there are User Groups that can possible help. -
How do I get my iTunes back? I am new to iPad and hit something wrong.
The default apps cannot be removed.
Check all homescreens and folders to ensure it has not been moved.
Check Settings > General > Restrictions to ensure that the iTunes store has not been restricted.
If neither of those resolves, select Settings > General > Reset > Reset Home Screen Layout. -
Mah nokia lumis 710 camera not working... what to...
mah nokia lumis 710 camera not working... what to do????
When you try to open the camera either by hitting the camera key or going to the app list, what happens?
1. Reboot the phone. Press the volume down and power keys together for 15 seconds until the phone vibrates and starts up.
2. Check that the software of the phone is updated.
3. Reset the phone by going to Settings > About. This deletes all the content of the phone so make sure to create a backup copy of your files. See "Reset and restore your phone" in this link to backup important data on the phone: http://support.microsoft.com/kb/2606900.
If above steps would not help, bringing the phone to a Nokia Care Point is what I'd suggest: http://www.nokia.com/global/support/locations/ -
Not sure what I did but projects are not showing up in the video window as i skim... Event footage does but project footage has sound but the video screen is gray... How do I get the vido to show in the viewer?
So you can ping and nslookup from your ms to these agents and vice versa right? I wouldn't do a manual install, I would push the agent from the management server. You can uninstall the agent manually, or use cleanmom to get rid of them. Then
do an install from the console. When you initiate the install from the console (management server), should it run into any issues it will dump out an error which will give you an idea of where the problem may be.
From Holmans post on this:
e MOM Server could not execute WMI Query "Select * from Win32_OperatingSystem" on
computer “servername.domain.com”
Operation: Agent Install
Install account: DOMAIN\account
Error Code: 800706BA
Error Description: The RPC server is unavailable.
The MOM Server could not execute WMI Query "(null)” on
computer “servername.domain.com”
Operation: Agent Install
Install account: DOMAIN\account
Error Code: 800706BA
Error Description: The RPC server is unavailable.
8004100A
800706BA
1. Ensure agent push account has local admin rights
2. Firewall is blocking NetBIOS access. If Windows 2008 firewall is enabled, ensure “Remote Administration (RPC)” rule is enabled/allowed. We need port 135 (RPC) and the DCOM port range opened for console push through a firewall.
3. Inspect WMI service, health, and rebuild repository if necessary
4. Firewall is blocking ICMP (Live OneCare)
5. DNS incorrect
http://blogs.technet.com/b/kevinholman/archive/2009/01/27/console-based-agent-deployment-troubleshooting-table.aspx
Regards, Blake Email: mengotto<at>hotmail.com Blog: http://discussitnow.wordpress.com/ If my response was helpful, please mark it as so, if it answered your question, then please also mark it accordingly. Thank you. -
After upgrading to 10.7.5 some of my AU plugins can not be validated in Logic pro. (I got error message "Remove property listener". I can not work anymore. What should I do?
VIBACI downloaded and installed
OS X Lion 10.7.5 Supplemental Update
and that solved my problem completely. (368 AU plugins now works!) -
Not sure what I did but all of a sudden everything I touch has a voice attached to it. For instance, if I touch an icon it tells me out loud what the icon is and tells me to double click it. ***??? Help!
Connect your iPhone to your computer via its USB cable and select it in the left column of iTunes.
Select the "Summary" tab, scroll to the bottom and click the "Configure Universal Access" button.
Disable "VoiceOver" and click the "OK" button.
Click the "Sync" button at the bottom-right. -
My home button is not working in iphone4 what should be do pls help.
My home button is not working in iphone4 what should be do pls help.
Basic troubleshooting from the User's Guide is reset, restart, restore (first from backup then as new). Try each of these in order until the issue is resolved.
If basic troubleshooting fails to resolve the issue, the next step is to take the device to Apple or an Apple Authorized Service Provider for evaluation.
Apple does not repair devices.
iDevices are not user servicable.
Any attempt by a 3rd party to repair the device will void the warranty and all rights to support from Apple and these forums. -
Media burner is not working in 4s what to do next
media burner is not working in 4s what to do next
As when there is a problem with a 3rd party app on your computer, contact the app developer for Media Burner regarding a problem with their iPhone app.
-
I connected my ipod touch 4g wi-fi with laptop ad hoc network....it's showing wi-fi signals but internet is not working...what is the problem in that can anyone help me...inadvances thanks
my laptop is Windows 7 and ip is this
192.168.102.12
255.255.255.0
192.168.102.1
DNS
192.168.254.2
192.168.254.3
in ipod touch 4g is DHCP and its showing
ip address 169.254.192.139
subnet mask 255.255.0.0.
remaining all blank -
I download the new IOS7 in my iPad beeing in the usa And where I come back to my country appears me again to upad te my iPad of ferina the IOS 7. I did it my iPhone And is not working as before.what i must do
I'm sorry, but I do not understand what you are asking or saying. Perhaps you could clarify a little bit.
-
I moved Photoshop CS5 to my new computer.. Its not working.. What to do?
What is not working exactly?
Did it install correctly? Accept the serial number OK? Activate OK? -
I have Iphone4 and my Iphone wifi button grayed out mean not working, Please suggest what need to do and i am using ios 6.
Please ask your question
-
My iphone 6plus not working not charge but when i run it the first time working half an hour when you attempt to run it again light up thr screen and showws the apple logo and after the pice screen illuminates red and does not work what do i do now
Hello Nadersalah,
It seems you're experiencing multiple issue with your iPhone. Based on the information you have provided, it appears your iPhone needs to be serviced. The following link should help you get started with the process and has links with additional information on topics such as warranty and service pricing, battery replacement, and express replacement service.
iPhone Repair and Service - Apple Support
Thank you for contributing to Apple Support Communities.
Cheers,
Bobby_D -
My ipad microphone next to the front camera, is not working at all, what can I do if the warranty is not available
Did you flip the switch?
http://i1224.photobucket.com/albums/ee374/Diavonex/91e9edf6b2127310428d94cf75cb6 15a_zps380c63c4.jpg
Maybe you are looking for
-
I am trying to use an Oracle XSQL query as a lookup table in my XSLT. I have figured out how to do this with Static data but am having slight difficulty using the XSQL. The easiest solution (I think) would be to return the resultset as a Namespace su
-
[solved] Gnome-do can't open home folder
I've been using gnome-do for a while now and like it, but I can't get it to open my home folder. This is with the docky theme. If I try to use it to open my home folder. What I mean is type super-space to bring up the text input box and then type "
-
JUST UPGRADED TO FIREFOX 4 AND NOW JAVASCRIPT NOT ENABLED EVEN THOUGH IT SAYS IT IS
when I enter data on a website I get this response...previous to firefox upgrade it was ok We have detected that your browser does not support JavaScript or it is disabled. This site requires JavaScript to be enabled to function correctly. If you con
-
In this PDF from emulex, it talks about how Emulex HBAs can be used to configure NPiV WWNs for Solaris non-global zones. http://www.emulex.com/artifacts/ddf25e8c-1d8e-456f-96ff-21a5353a9d59/solaris10-6.pdf I have yet to find any detailed information
-
How to set 32bit ODBC connection to the application in 64 bit OS
hi, I have BO installed in 64 Bit windows OS and the mysql data server in 32bit windows OS. i created DNS on the server for the data server. when i click on test connection, I'm getting a message DBD:[Microsoft][ODBC Driver Manager] Data source name