Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


select statement


select statement

Author
Message
Frances L
Frances L
Old Hand
Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)Old Hand (357 reputation)

Group: General Forum Members
Points: 357 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.
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24177 Visits: 37948
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



Cool
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)
Matt Miller (#4)
Matt Miller (#4)
SSCertifiable
SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)

Group: General Forum Members
Points: 7641 Visits: 18070
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?
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search