SQL Data Query... Records with Missing Date?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

SQL Data Query... Records with Missing Date?

DKUKEC
After reviewing the FM, Google, and the IBM site, I have had no luck with the
following question.  Is it possible to query records with missing dates?  I
have posted below the syntax generated by the SPSS database query wizard...  

I am looking to query --- DISPOSITIONDATE GE 01/01/2018 AND DISPOSITIONDATE
LE 01/11/2018 OR MISSING (DISPOSITIONDATE).

Thank you
Damir

----------------------------------------------------------------------------------------------------------------

NEW FILE .
DATASET CLOSE ALL .

GET DATA
  /TYPE=ODBC
  /CONNECT='DSN=CJC Clerk Data;UID=;Trusted_Connection=Yes;APP=IBM SPSS
Products: Statistics '+
    'Common;WSID=CJC-101947310;DATABASE=CrimJustCom'
  /SQL="SELECT AgencyID, AgencyName, AppealDate, ArrestDate,
AsstPublicDefenderID, "+
    "AsstStateAttorneyID, AsstStateAttorneyID2, AttyForDefenseID,
AttyForDefenseID2, Authority, "+
    "BookingSheetNumber, CapiasIssuedDate, CaseCounts, CaseID, CaseNumber,
CasePhase, CaseStatus, "+    
    "CaseType, CaseTypeDescription, ContinuanceRequestCourt,
ContinuanceRequestDefense, "+
    "ContinuanceRequestState, ContinuanceRequestStipulation, CourtAction,
CourtAction_FDLE_Code, "+
    "CourtAction_SRSCode, CourtActionID, CourtAptAtty, CourtType,
CourtTypeDescription, "+
    "CreateDate, CreatedBy, CrimeLocation, CurrentJudgeName, DateBooked,
DCNumber, Department, "+
    "DisposedBeforeTrial, Disposition, DispositionDate, DivisionID,
DivisionName, FileDate, "+
    "FingerPrintsTaken, GeographicIndicator, IncidentNumber, Incompetent,
Indigent, "+
    "JudgeAtDisposition, JuryTrial, LastName, LegacyCaseFormat,
LegacyCaseNumber, Location, "+
    "LocationDescription, ModifiedBy, ModifyDate, NameAtArrest,
NumberOfDefendants, OBTSNumber, "+
    "OffenseDate, ProSe, PublicDefender, ReopenCloseDate, ReopenDate,
ReopenReason, Sealed, "+
    "SpeedyTrialDemandDate, SpeedyTrialDueDate, SpeedyTrialWaivedDate,
SuspenseCaseMerged, UCN, "+
    "VOPCount, WaiverOfRightToCounsel, CaseStyle, ZipCode, DivisionID_No
FROM "+
    "CrimJustCom.dbo.vCJC_Case WHERE (DispositionDate >= '01/01/2018' OR
DispositionDate ='MISSING')"
  /ASSUMEDSTRWIDTH=255.

CACHE.
EXECUTE.
DATASET NAME DATA WINDOW=FRONT.



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SQL Data Query... Records with Missing Date?

David Marso
Administrator
My thoughts lean towards BETWEEN and IS NULL.  Do a little Googling...
Not SPSS Specific but SQL in general.
---

DKUKEC wrote

> After reviewing the FM, Google, and the IBM site, I have had no luck with
> the
> following question.  Is it possible to query records with missing dates?
> I
> have posted below the syntax generated by the SPSS database query
> wizard...  
>
> I am looking to query --- DISPOSITIONDATE GE 01/01/2018 AND
> DISPOSITIONDATE
> LE 01/11/2018 OR MISSING (DISPOSITIONDATE).
>
> Thank you
> Damir
>
> ----------------------------------------------------------------------------------------------------------------
>
> NEW FILE .
> DATASET CLOSE ALL .
>
> GET DATA
>   /TYPE=ODBC
>   /CONNECT='DSN=CJC Clerk Data;UID=;Trusted_Connection=Yes;APP=IBM SPSS
> Products: Statistics '+
>     'Common;WSID=CJC-101947310;DATABASE=CrimJustCom'
>   /SQL="SELECT AgencyID, AgencyName, AppealDate, ArrestDate,
> AsstPublicDefenderID, "+
>     "AsstStateAttorneyID, AsstStateAttorneyID2, AttyForDefenseID,
> AttyForDefenseID2, Authority, "+
>     "BookingSheetNumber, CapiasIssuedDate, CaseCounts, CaseID, CaseNumber,
> CasePhase, CaseStatus, "+    
>     "CaseType, CaseTypeDescription, ContinuanceRequestCourt,
> ContinuanceRequestDefense, "+
>     "ContinuanceRequestState, ContinuanceRequestStipulation, CourtAction,
> CourtAction_FDLE_Code, "+
>     "CourtAction_SRSCode, CourtActionID, CourtAptAtty, CourtType,
> CourtTypeDescription, "+
>     "CreateDate, CreatedBy, CrimeLocation, CurrentJudgeName, DateBooked,
> DCNumber, Department, "+
>     "DisposedBeforeTrial, Disposition, DispositionDate, DivisionID,
> DivisionName, FileDate, "+
>     "FingerPrintsTaken, GeographicIndicator, IncidentNumber, Incompetent,
> Indigent, "+
>     "JudgeAtDisposition, JuryTrial, LastName, LegacyCaseFormat,
> LegacyCaseNumber, Location, "+
>     "LocationDescription, ModifiedBy, ModifyDate, NameAtArrest,
> NumberOfDefendants, OBTSNumber, "+
>     "OffenseDate, ProSe, PublicDefender, ReopenCloseDate, ReopenDate,
> ReopenReason, Sealed, "+
>     "SpeedyTrialDemandDate, SpeedyTrialDueDate, SpeedyTrialWaivedDate,
> SuspenseCaseMerged, UCN, "+
>     "VOPCount, WaiverOfRightToCounsel, CaseStyle, ZipCode, DivisionID_No
> FROM "+
>     "CrimJustCom.dbo.vCJC_Case WHERE (DispositionDate >= '01/01/2018' OR
> DispositionDate ='MISSING')"
>   /ASSUMEDSTRWIDTH=255.
>
> CACHE.
> EXECUTE.
> DATASET NAME DATA WINDOW=FRONT.
>
>
>
> --
> Sent from: http://spssx-discussion.1045642.n5.nabble.com/
>
> =====================
> To manage your subscription to SPSSX-L, send a message to

> LISTSERV@.UGA

>  (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: SQL Data Query... Records with Missing Date?

DKUKEC
In reply to this post by DKUKEC
Thank you David,

You were right about IS NULL.  The following worked...

((T1.DispositionDate >= '01/01/2018' AND T1.DispositionDate <= '01/10/2018')
OR "+
    "T1.DispositionDate IS NULL)

Damir



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD