| Author |
Topic |
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 00:51:46
|
| SELECT per_request_aud.user_id, per_request_aud.date_stamp, DECODE (per_request_aud.request_no, 1, 'Old', 2, 'New'), per_request_aud.request_no, pda.request_type (per_request_aud.request_type) req_type, per_request_aud.person_name1 || ' ' || per_request_aud.person_name2 || ' ' || per_request_aud.person_name3 || ' ' || per_request_aud.person_name4 || ' ' || per_request_aud.person_name5, per_request_aud.per_id, per_request_aud.card_no, per_request_aud.mobile_no1, per_request_aud.approved_amount FROM per_request_aud WHERE TO_CHAR (per_request_aud.date_stamp) LIKE :date_inputORDER BY per_request_aud.trans_seq GROUP BY per_request_aud.per_idI am using above query to get rows together having same column value...But I dont know why i m getting an error of invalid sql command... Please HelpSohail Malik |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-03 : 01:20:21
|
| Seems that you are working on Oracle ... if so please post your question on Oracle Forums as this is Microsoft SQL server one....!CheersMIK |
 |
|
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 01:22:36
|
| Okay... Thanks, but btw if you know the problem can you help me in this regrads??And is this query correct?? |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-03 : 01:37:27
|
| well Sohail have not worked on Oracle for some time so dont have confirmed knowledge over the syntax. however try to debug the code in parts as i usually do when i get generic sort of errors. try running the code in parts .. e.g. 1)Select Col1From TableName2) Select Col1,Col2From TableName3)Select Col1,Col2,...,ColNFrom TableName4)Select Col1,Col2,...,ColNFrom TableNameWhere <conditions>...This way you will at least find out the problematic portion of a code :DCheersMIK |
 |
|
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 02:13:06
|
| sure, i have done this before. And many many thanks for the reply. Let me easy ur life, when i placed the line below in the query it give me error.GROUP BY per_request_aud.per_idthe query is running fine without group by clause, I want to show two rows together having same Per_id.I hope that you understand my problem and I also wish to get a reply from you soon =) |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-03 : 02:19:12
|
quote: Originally posted by sohail.mahmood69 sure, i have done this before.
Don't think so .. otherwise you should have figured it out .. !! anyhow good to know that you have fixed it out !! Cheers! MIk |
 |
|
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 02:23:50
|
| I think u mis-understood me.... the query is running fine without the "Group By" clause. When I put this clause then I am having an error =(Sohail Malik |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-03 : 02:30:36
|
| "the query is running fine without group by clause, I want to show two rows together having same Per_id" Well you might know that Group By Works over Group Functions e.g. Avg, Sum, Count etc ... Group By clause is not for the --> "two rows tegether having same per_ID". Perhaps you can use DISTINCT sort of clause in Oracle for what you what .. however that will works only if there is Duplication at Row Level (values in columns are same) Cheers!MIK |
 |
|
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 02:42:32
|
| Thank You =)One more question!DISTINCT is for getting different data. Any clause for getting same data together?? |
 |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-03 : 02:50:08
|
| :-$ i think i am getting confused :D or i am unable to understand what you want .. Do you want the duplication to be there in your data set but to show the duplicated rows at adjacent to each other ("Any clause for getting same data together")? if this is so Then use -- Order By Per_id |
 |
|
|
sohail.mahmood69
Starting Member
7 Posts |
Posted - 2011-02-03 : 02:55:26
|
| this discussion is getting more and more complex or it will become complex if i started explaining you the whole query. let the things easy and think that there will be idealism around =)anyways thanks for sparing your time here in my problem =)Sohail Malik |
 |
|
|
|