Hi,
How can we write SQL queries for followings:-
1) To delete duplicate records from a file.
2) To show distinct count of a customers if he has more than one department ids for example this query should display customer ID and it's associated department ids count as followings:-
Customer ID Dept ID
C21 D1,D2
so above Custome has 2 department IDs so output of the query should display like below:-
Customer ID Dept ID Count
C21 2
3) How can we write SQL query to sort rows in ascending Orders for example if we have below table or file X:-
Then we want to arrange rows of above table/file in ascending order like below table /File Y : -
Then How can we achieve it by writing any SQL query ?
If it is not possible using SQL query what shortest lines of program code should be able to provide desired output for this?
Thanks...
How can we write SQL queries for followings:-
1) To delete duplicate records from a file.
2) To show distinct count of a customers if he has more than one department ids for example this query should display customer ID and it's associated department ids count as followings:-
Customer ID Dept ID
C21 D1,D2
so above Custome has 2 department IDs so output of the query should display like below:-
Customer ID Dept ID Count
C21 2
3) How can we write SQL query to sort rows in ascending Orders for example if we have below table or file X:-
Fld1 | fld2 | fld3 |
30 | 10 | 25 |
25 | 60 | 18 |
20 | 30 | 40 |
Then we want to arrange rows of above table/file in ascending order like below table /File Y : -
fld1 | fld2 | fld3 |
10 | 25 | 30 |
18 | 25 | 60 |
20 | 30 | 40 |
Then How can we achieve it by writing any SQL query ?
If it is not possible using SQL query what shortest lines of program code should be able to provide desired output for this?
Thanks...
Comment