Jump to content

Sql Query Suggestions


Recommended Posts

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

  • BeerBond007

    11

  • loveindia

    6

  • creativity

    5

  • k2s

    3

Top Posters In This Topic

Posted

man, you can do this many different ways.. one way is use a cte

 

;WITH CTE AS

(

write your join tables query here and get desired output first

)

SELECT state, deductible, CASE WHEN state = 'FL.' AND deductible = 0 THEN 'FULL' ELSE deductible END AS newColumnName

FROM CTE;

 

you can write the same using simple select statement in the same query also.. just because I dont have the query I can write this but this is also much better and faster...

 

good luck man...

Posted

man, you can do this many different ways.. one way is use a cte

;WITH CTE AS
(
write your join tables query here and get desired output first
)
SELECT state, deductible, CASE WHEN state = 'FL.' AND deductible = 0 THEN 'FULL' ELSE deductible END AS newColumnName
FROM CTE;

you can write the same using simple select statement in the same query also.. just because I dont have the query I can write this but this is also much better and faster...

good luck man...

wrong
Posted

wrong

 

machine arustundi ikkada man... 2 months back 77k lo unnav, ippudu 92k lo unnav... families india went aa kompateesi daddy man...

Posted

machine arustundi ikkada man... 2 months back 77k lo unnav, ippudu 92k lo unnav... families india went aa kompateesi daddy man...

:O
Nope ikkada machine kevving
2 months back 90k, now 92k...write a query & Check stats rey
Howz married life ?
Posted

:o
Nope ikkada machine kevving
2 months back 90k, now 92k...write a query & Check stats rey
Howz married life ?

 

checked ur stats and ur pathivratyam is proved daddy man... you are ahalya the amayakuraalu....

Posted

man, you can do this many different ways.. one way is use a cte

;WITH CTE AS
(
write your join tables query here and get desired output first
)
SELECT state, deductible, CASE WHEN state = 'FL.' AND deductible = 0 THEN 'FULL' ELSE deductible END AS newColumnName
FROM CTE;

you can write the same using simple select statement in the same query also.. just because I dont have the query I can write this but this is also much better and faster...

good luck man...


Int column lo varchar values using case statement ki oka bug undi bro ...

Conversion failed wh converting the varchar value 'Full' to data type int ani


Select case when deduct = 0 and state = 'FL' then 'Full' else cast (deduct as varchar(10) end from tables joins conditions .....


Else tarwatha aaa casting aaa error ki fix.::.

Blog lo rasko help avtadi vere vallaki
Posted

Int column lo varchar values using case statement ki oka bug undi bro ...

Conversion failed wh converting the varchar value 'Full' to data type int ani


Select case when deduct = 0 and state = 'FL' then 'Full' else cast (deduct as varchar(10) end from tables joins conditions .....


Else tarwatha aaa casting aaa error ki fix.::.

Blog lo rasko help avtadi vere vallaki

enti data conversion ni and case statements kuda blog lo ki ekkinchaala
?

Posted

SELECT state, deductible, CASE WHEN state = 'FL.' AND deductible = 0 THEN 'FULL' ELSE to_char(deductible) END AS newColumnName

×
×
  • Create New...