Table : user -------------- | Id | Name | -------------- | 1 | Test | | 2 | Test1 | | 3 | TEst2 | | 4 | Test3 | | 5 | Test4 | | 6 | Test5 | | 7 | Test6 | -------------- Query : selecr concat(id,":",name) as output from user Output: ------------ | output | ------------ | 1:Test | | 2:Test1 | | 3:TEst2 | | 4:Test3 | | 5:Test4 | | 6:Test5 | | 7:Test6 | ------------
Html, JAVA,DOTNET,Javascript, PHP, and JQuery Scripts and its issues with solutions
Showing posts with label query. Show all posts
Showing posts with label query. Show all posts
Tuesday, 12 August 2014
Mysql get two column value in get single field
Mysql get multi row value in get single field
Table : user -------------- | Id | Name | -------------- | 1 | Test | | 2 | Test1 | | 3 | TEst2 | | 4 | Test3 | | 5 | Test4 | | 6 | Test5 | | 7 | Test6 | -------------- Query : select group_concat(concat(id) SEPARATOR ',') from user Output: 1,2,3,4,5,6,7
Monday, 30 June 2014
MySQL IF function
MySQL IF function
Syntax: IF(expr,if_true_expr,if_false_expr)
Example:
SELECT IF(1 = 2,'true','false'); -- false
SELECT IF(1 = 1,' true','false'); -- true
Syntax: IF(expr,if_true_expr,if_false_expr)
Example:
SELECT IF(1 = 2,'true','false'); -- false
SELECT IF(1 = 1,' true','false'); -- true
Subscribe to:
Posts (Atom)