Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

select statement Expand / Collapse
Author
Message
Posted Wednesday, October 29, 2008 1:01 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Sunday, September 18, 2011 6:11 PM
Points: 355, Visits: 299
I have table in MS ACCESS:

has hire_date, rehired_Date, Termination_Date.


I want to

select rehired_date as hire_date when terminate_date

How to write this statement ?

ig:

hired_date as 10/1/07
termination date 10/03/07
rehired_date 10/2/08

then the hired_date will outcome as 10/02/08

hired_date as 10/1/07
termination date 10/02/07
rehired_date null

then the hired_date will outcome as 10/01/07


hired_date as 10/1/07
termination date 10/03/07
rehired_date is 10/02/07

then the hired_date will outcome as 10/02/07

Thx.
Post #593878
Posted Wednesday, October 29, 2008 1:09 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 6:48 PM
Points: 20,734, Visits: 32,499
Frances L (10/29/2008)
I have table in MS ACCESS:

has hire_date, rehired_Date, Termination_Date.


I want to

select rehired_date as hire_date when terminate_date

How to write this statement ?

ig:

hired_date as 10/1/07
termination date 10/03/07
rehired_date 10/2/08

then the hired_date will outcome as 10/02/08

hired_date as 10/1/07
termination date 10/02/07
rehired_date null

then the hired_date will outcome as 10/01/07


hired_date as 10/1/07
termination date 10/03/07
rehired_date is 10/02/07

then the hired_date will outcome as 10/02/07

Thx.


Not seeing termination date having anything to do with what is returned. Looks to like you want something like this:

select isnull(rehired_date, hired_date) from sometable




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #593882
Posted Wednesday, October 29, 2008 3:18 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 10:00 PM
Points: 7,105, Visits: 15,443
If you're using natve Access queries - you will need to use the NZ function instead of the ISNULL function Lynn mentioned (ISNULL is something different in Access).

----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Post #593967
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse