View previous topic :: View next topic
|
Author |
Message |
VivekKhanna
New User
Joined: 09 Feb 2009 Posts: 57 Location: India
|
|
|
|
Hi All,
I need some help in formulating a SELECT query that should provide me with some constant values from the table.
For example:
The are four columns in the table TAB1 namely COL1, COL2, COL3.
I want all the values for COL2 keeping COL1 as "AAA" and COL3 as Current Timestamp, for a specified where condition on COL1. The resultant should be:
Code: |
COL1 COL2 COL3
------- --------- -------------------
XXX ABC TIMESTAMP
XXX AAB TIMESTAMP
XXX AAC TIMESTAMP
XXX AAA TIMESTAMP
|
The values for COL2 should be selected on condition where COL1='YYY' |
|
Back to top |
|
|
Srihari Gonugunta
Active User
Joined: 14 Sep 2007 Posts: 295 Location: Singapore
|
|
|
|
Vivek,
You can try this.
Code: |
SELECT 'AAA' AS COL1, COL2, CURRENT TIMESTAMP AS Col3
FROM TAB1 WHERE COL1 = 'YYY'; |
|
|
Back to top |
|
|
VivekKhanna
New User
Joined: 09 Feb 2009 Posts: 57 Location: India
|
|
|
|
Thanks Srihari,
I got it figured out. Thanks for the heads up. |
|
Back to top |
|
|
|