[VIEWED 5207
TIMES]
|
SAVE! for ease of future access.
|
|
|
hurray
Please log in to subscribe to hurray's postings.
Posted on 02-11-05 7:59
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I have a table with data in following order. ID Career Term Bill_Career A GR 50 GR B UGR 50 UGR C UGR 50 UGR D GR 50 GR E UGR 50 UGR A UGR 50 GR B GR 50 GR C GR 50 GR What I am looking for is, any ID that occures twice with Different Bill_Career. How can I make the output look like ID Career Term Bill_Career B UGR 50 UGR B GR 50 GR C UGR 50 UGR C GR 50 GR
|
|
|
|
apu
Please log in to subscribe to apu's postings.
Posted on 02-11-05 9:13
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
SELECT DISTINCT ID_CARRER_TERM_BILL_CAREER , B UGR , C UGR FROM TABLENAME Distinct key word has to be used before the column name to eliminate the duplicate values eg Select disctinct columname, column from table name where condition.
|
|
|
usofa
Please log in to subscribe to usofa's postings.
Posted on 02-11-05 9:32
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
SELECT B UGR 50 UGR, B GR 50 GR, C UGR 50 UGR, C GR 50 GR FROM TableName;
|
|
|
Dada_Giri
Please log in to subscribe to Dada_Giri's postings.
Posted on 02-11-05 9:42
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
>What I am looking for is, any ID that occures twice with Different Bill_Career. It means u r looking for a Unique ID ? Is it? My answer would be similar to usof but You say you are looking for ID that comes twice? Would you make your question a lil bit clear?
|
|
|
Aryan
Please log in to subscribe to Aryan's postings.
Posted on 02-11-05 9:49
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Hurray, Here is the answer. select a.id,a.career, a.term, a.bill_career from rg_semester a, /* this rg_semester table is assumption */ rg_semester b where a.id = b.id and a.bill_career != b.bill_career and a.id in (select a.id from rg_semester group by a.id having count(a.id)>1); ID CAREER TERM BILL_CAREE -- ---------- ----- ---------- B GR 50 GR B UGR 50 UGR C GR 50 GR C UGR 50 UGR Good Luck.
|
|
|
chameli02
Please log in to subscribe to chameli02's postings.
Posted on 02-11-05 9:51
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Select ID_Career, Bill_term_career From TableName Group by ID_Career Try this and see if it helps.. Let me know too. I will try other query's if this is not what you are looking for.
|
|
|
chameli02
Please log in to subscribe to chameli02's postings.
Posted on 02-11-05 9:52
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Think Aryan has nailed it.
|
|
|
usofa
Please log in to subscribe to usofa's postings.
Posted on 02-11-05 9:55
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
if you want to retrive the distinct colums from table then SELECT DISTINCT ID Career from TableName Where IDCareer IN ('B','c'); or SELECT DISTINCT ID career from Tablename whrere IDCareer like "%b" and "%c"; i am not sure though... just try it...
|
|
|
usofa
Please log in to subscribe to usofa's postings.
Posted on 02-11-05 9:56
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
select a.id,a.career, a.term, a.bill_career from rg_semester a, /* this rg_semester table is assumption */ rg_semester b where a.id = b.id and a.bill_career != b.bill_career and a.id in (select a.id from rg_semester group by a.id having count(a.id)>1); ID CAREER TERM BILL_CAREE -- ---------- ----- ---------- B GR 50 GR B UGR 50 UGR C GR 50 GR C UGR 50 UGR great!
|
|
|
Aryan
Please log in to subscribe to Aryan's postings.
Posted on 02-11-05 9:58
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
usofa, if there are 100000 of row, how would you know only 'B' & 'C' id have distinct values in bill_career? The logic wouldn't work. Just my two cents.
|
|
|
hurray
Please log in to subscribe to hurray's postings.
Posted on 02-11-05 10:00
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Aryan, I am not sure but yours looks right to me. The way I figured out was : select A.* from tablename A, tablename B where A.ID = B.ID and A.term = B.term and A.bill_career <> B.bill_career Anyway, thanks to everyone.
|
|
|
hurray
Please log in to subscribe to hurray's postings.
Posted on 02-11-05 10:04
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
the last statement should be A.bill_career <> B.bill_career
|
|
|
hurray
Please log in to subscribe to hurray's postings.
Posted on 02-11-05 10:05
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
not equal Sajha doesn't let me put that sign
|
|
|
Aryan
Please log in to subscribe to Aryan's postings.
Posted on 02-11-05 10:07
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
you can put not equal sign different ways. != OR <> OR ^=
|
|
|
chameli02
Please log in to subscribe to chameli02's postings.
Posted on 02-11-05 10:23
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
I agree with Aryan's Query
|
|
|
testdirector
Please log in to subscribe to testdirector's postings.
Posted on 02-11-05 11:22
AM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
Can someone explain it in english. The operators, statement etc
|
|
|
usofa
Please log in to subscribe to usofa's postings.
Posted on 02-11-05 2:13
PM
Reply
[Subscribe]
|
Login in to Rate this Post:
0
?
|
|
The commonl logical operators are AND, OR , NOT. there are other types of operators as well. they can be classified as followes. Comparison Operators mathematical functions and Ooperators string Functions and Operators Binary String Functions and Operators Pattern Matching
|
|