Jump to content

sql experts please come


4Vikram

Recommended Posts

1 minute ago, 4Vikram said:

create cheyale table lo ledu.. its like new column for result set anthe 

alter table [tbl_APP_DROPDOWN_VALUES]  add STATE_ID  int 

 

idi run chesi malli payi query run chey 

Link to comment
Share on other sites

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

  • 4Vikram

    21

  • JollyBoy

    10

  • mettastar

    4

  • kittaya

    4

Top Posters In This Topic

7 minutes ago, JollyBoy said:

alter table [tbl_APP_DROPDOWN_VALUES]  add STATE_ID  int 

 

idi run chesi malli payi query run chey 

baa point endi ante cant add new column to that table..

General ga manam use chestam kada firstname +lastname = fullname ani result set lo atla ravali.. ill show you one query what I already used and its working now.. 

 

SELECT
       A.[MWC_ID]
      ,A.[CATEGORY_1]
      ,A.[CATEGORY_2]
      ,A.[STRING_VALUE1]
      ,A.[STRING_VALUE2]
      ,B.STATE_ID 
FROM [tbl_APP_DROPDOWN_VALUES] A
LEFT JOIN 
        (SELECT [STRING_VALUE1], DENSE_RANK() OVER (ORDER BY [STRING_VALUE1]) STATE_ID 
         FROM [tbl_APP_DROPDOWN_VALUES]  
         WHERE CATEGORY_1 = 'State' AND CATEGORY_2 = 'County') B
ON A.[STRING_VALUE1]=B.[STRING_VALUE1]
WHERE CATEGORY_1 = 'State' AND CATEGORY_2 = 'County'

Link to comment
Share on other sites

2 minutes ago, 4Vikram said:

baa point endi ante cant add new column to that table..

General ga manam use chestam kada firstname +lastname = fullname ani result set lo atla ravali.. ill show you one query what I already used and its working now.. 

 

SELECT
       A.[MWC_ID]
      ,A.[CATEGORY_1]
      ,A.[CATEGORY_2]
      ,A.[STRING_VALUE1]
      ,A.[STRING_VALUE2]
      ,B.STATE_ID 
FROM [tbl_APP_DROPDOWN_VALUES] A
LEFT JOIN 
        (SELECT [STRING_VALUE1], DENSE_RANK() OVER (ORDER BY [STRING_VALUE1]) STATE_ID 
         FROM [tbl_APP_DROPDOWN_VALUES]  
         WHERE CATEGORY_1 = 'State' AND CATEGORY_2 = 'County') B
ON A.[STRING_VALUE1]=B.[STRING_VALUE1]
WHERE CATEGORY_1 = 'State' AND CATEGORY_2 = 'County'

oh k i didnt read from start.. good, let me know if you need anything further

Link to comment
Share on other sites

state name and StateID tho oka master table create chesuko,

main table ni join chesuko master table ki. simple ga ayipodhi.

case statements 47 states ki rasthe query chanthadu avvudhi..

 

Link to comment
Share on other sites

1 hour ago, JollyBoy said:

oh k i didnt read from start.. good, let me know if you need anything further

awight

49 minutes ago, KrishnaDevaRaya said:

state name and StateID tho oka master table create chesuko,

main table ni join chesuko master table ki. simple ga ayipodhi.

case statements 47 states ki rasthe query chanthadu avvudhi..

 

ledu le case statements rayle antha ganam vere laga chesna and that worked well

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...