Clicky

Hi experts,
I have two tables A and B.Below are the data for Table A and B. I have a function that will generate 3 when I input PIN:65000(there is some internal calculation and 3 is the alternative id for 2)

Table A:                
PIN         ID      dt
65000      2      01/20/2011
45000      3      02/03/2011
I have to write a CTE where when I give 65000 as input to it, it should output to me the date corresponding to 3 ie. 02/03/2011.
Thanks

asked 12/15/2011 08:21

sqlcurious's gravatar image

sqlcurious ♦♦


5 Answers:
what is the logic behind you want to return the values of ID 3 when you request values of ID 2?

A CTE won't do that!
link

answered

emoreau's gravatar image

emoreau

what relation in table A and B
If A and B have same data or data values then why we need to create two tables
link

answered 2011-12-16 at 03:42:34

AlokJain0412's gravatar image

AlokJain0412

I am sorry there are no two tables, there is only one table. The values that I have given are some dummy values, in reality PIN is a policynumber and ID is a policyID.
emoreau, and regarding the logic as I said I have a function that does that logic, it returns 3 as thats the alternate ID for 2.
Thanks
link

answered 2011-12-16 at 03:43:12

sqlcurious's gravatar image

sqlcurious

so why don't you do

select * from YourTable where ID = YourMagicFunction(65000)
link

answered 2011-12-16 at 07:44:12

emoreau's gravatar image

emoreau

thanks
link

answered 2011-12-16 at 07:57:40

sqlcurious's gravatar image

sqlcurious

Your answer
[hide preview]

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: 12/15/2011 08:21

Seen: 198 times

Last updated: 12/16/2011 01:29