Jump to content

Sql Help.. Urgent.. Please Help...


Recommended Posts

Posted

by using CASE...you can create your own column...in the resultant

 

maya :(

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

  • Gutka_Mukesh

    11

  • vikuba

    10

  • ChampakDas

    10

  • bokuboy

    4

Popular Days

Top Posters In This Topic

Posted

maya :(

endhi mayya nee bongu..

maa lakkaraju ganiki marketing cheyi saami.

manchodu..h1 undhi job ledhu..

training paisal endhi...candidates teeskostey itla karey tho kaisaa..

Posted

bhayya nuvu mari values restict chestunnav...INDIA-TN ani raste query update chestava malli...query's should never be dependent on values...cool

well he can write the query with String identification rite..

if substring(country,4 = INDI) then ...A ani pettestey aipothadi.

so appdu value update aiy ey state vachina country same kabatti...it works..

Posted

Man... table chala peddadi... edana iteration undali... anni values type cheyadam kastam man...

 

 

Select country,

 

case when INDIA AP, INDIA MP , INDIA UP then A

case when USA tx, USA cal, USA NY then B 

Case when  Africa-Anti, Afirca Zim then C

 

end as Person , 

 

countryID

 

from TEMP TABLE..

 

 

thts it

 

 

by using CASE...you can create your own column...in the resultant

 

Posted

well he can write the query with String identification rite..

if substring(country,4 = INDI) then ...A ani pettestey aipothadi.

so appdu value update aiy ey state vachina country same kabatti...it works..

 

so 195+ countries ki ala cheskunta potaava enti query lo 

Posted

CountryTable:

Country Person CountryID
India A 1
USA B 2
Africa C 3


Paina unna table data ni modify chesi oka temp table lo pettanu...

TempTable:

Country CountryID
India-AP 1
India-MP 1
India-UP 1

USA-Texas 2
USA-California 2
USA-NY 2

Africa-Zimbabwe 3
Africa-Angola 3



Naku kavalasina result...

Country Person CountryID
India-AP A 1
India-MP A 1
India-UP A 1

USA-Texas B 2
USA-California B 2
USA-NY B 2

Africa-Zimbabwe C 3
Africa-Angola C 3


Please help... very urgent.. CITI#H@



Select * from maintable a, temptable b
Where substr(b.country,1,instr(b.country,'-')-1)=a.country
Posted

Man... table chala peddadi... edana iteration undali... anni values type cheyadam kastam man...

use string identification...

if INDI then assign A..laaga..

using substring.

 

I gave the query on lower levels...in testing perspective..

thts what i know..i dont know pl/sql types..my bad

Posted

Thanks for replying man.. em anukokunda okka sari naa question chudava??

 

First table lo unna person ni... 3rd table data loki marchali... using country ID in the second table...

 

Single records for persons... unna first table.. multiple records laaga maarali...

 

Country        

 

Posted

so 195+ countries ki ala cheskunta potaava enti query lo 

maayya kshaminchandi...

i gave to my knowledge.

Posted

Select * from maintable a, temptable b
Where substr(b.country,1,instr(b.country,'-')-1)=a.country

nice man....

good one.

Posted

Select * from maintable a, temptable b
Where substr(b.country,1,instr(b.country,'-')-1)=a.country

 

this should work !

Posted

maayya kshaminchandi...

i gave to my knowledge.

 

no worries man, naku peddaga em teleedu.

me too not from the IT background

Posted

Thanks for replying man...

 

logic not working man...

 

 

Use the Id in the temp table to insert new rows in the 3rd table...

 

 

 

Select * from maintable a, temptable b
Where substr(b.country,1,instr(b.country,'-')-1)=a.country

 

 

 

Posted

declare @table1 table
(
country char(10),
person char(1),
countryid int
)

declare @table2 table
(
country char(20),
countryid int
)

insert into @table1 values('India', 'A', 1)
insert into @table1 values('USA', 'B', 2)
insert into @table1 values('Africa', 'C', 3)


insert into @table2 values('India-AP', 1)
insert into @table2 values('India-MP', 1)
insert into @table2 values('India-UP', 1)
insert into @table2 values('USA-Texas', 2)
insert into @table2 values('USA-California', 2)
insert into @table2 values('USA-NY', 2)
insert into @table2 values('Africa-Zim', 3)
insert into @table2 values('Africa-Ang', 3)

select b.country, a.person, a.countryid
from @table1 a
inner join @table2 b on a.countryid = b.countryid

×
×
  • Create New...