September 25, 2009 at 11:36 am
Dear All,
I am a j2ee developer.I don’t know much more knowledge about sql query except Simple Insert,delete,select statement.
Please help me how to write this query
select LOCALE_CODE, LOCALE_LANGUAGE_DESCRIPTION from LOCALE //Master Table
LOCALE_CODE LOCALE_LANGUAGE_DESCRIPTION
en_US English
fr_CA French Canadian
SELECT Name, Age, LOCALE_CODE FROM LOGIN_USER WHERE LOGIN_NAME=’Pqr’ //Transaction table.
By using two table how to write a single query
If (LOGIN_USER table is having LOCALE_CODE =’ en_U S’)
Then it will return
LOCALE_CODE LOCALE_LANGUAGE_DESCRIPTION
en_U English
fr_CA French Canadian
If (LOGIN_USER table is having LOCALE_CODE =’ fr_CA ’)
Then it will return
LOCALE_CODE LOCALE_LANGUAGE_DESCRIPTION
fr_CA French Canadian
en_U English
If (LOGIN_USER table is having LOCALE_CODE IS NULL)
Then it will return
LOCALE_CODE LOCALE_LANGUAGE_DESCRIPTION
en_US English
fr_CA French Canadian
Thanks for your time.
Regards,
Sumanta
September 25, 2009 at 2:37 pm
Sorry if I am underestimating your requirement, (it was not clear though) but i think 'CASE' statement should be useful,
look at the syntax and usage here.
http://msdn.microsoft.com/en-us/library/ms181765.aspx
If this does not server your purpose, please give some sample data and the create script for your tables so that it becomes easy for folks to provide you the query.
---------------------------------------------------------------------------------
September 25, 2009 at 4:20 pm
I too cannot follow what you are looking for. You either need a CASE in the SELECT list, or something in the WHERE clauses, but it's not clear.
When you show samples, please show if it is one row or multiple ones you are wanting to return.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply