SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


select statement


select statement

Author
Message
Frances L
Frances L
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2313 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 Guru
SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)SSC Guru (223K reputation)

Group: General Forum Members
Points: 223353 Visits: 40403
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)
SSC Guru
SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)SSC Guru (67K reputation)

Group: General Forum Members
Points: 67730 Visits: 19983
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