Jump to content

LAs

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by LAs

  1. Hello guys, i need some basic info here. I need to build string, which must be builded into "'%name%'", when name is a variable.

    Using concat, its easy to do that:String myString = "'%" + name + "%'";how to do that with String.format() ?I`m trying to do like: String myString = String.format("'%%s%'", name); << it appears a problem with "%'" tag. how to avoid that ? How to use double %`s in the quotas ?Any suggestions ?

    Linas.

  2. Ok guys, need to wake up this thread again.

     

    When i`m using sorting method with "order by case" and when ... then [number], i can use only 255 arguemnts in this state. The words like "when" "then" are described as variables (am i write?). Ok, so how to avoid those arguments limit ?

     

    What kind of trick do you know and using, guys ?

  3. You can order further by LENGTH(CustomerName).

    And where should i put this function ? Because i was trying to put it everywhere, still doesnt work..

     

    Should i put it smth like:

    SELECT * FROM Customers ORDER BY CASEWHEN CustomerName LIKE '%a%' THEN 1 ORDER BY LENGHT(CustomerName)WHEN CustomerName LIKE '%b%' THEN 2 ORDER BY LENGHT(CustomerName)ELSE 3 ORDER BY LENGHT(CustomerName)END
    I mean, if i have data like:
    "house"
    "cup"
    "apartament"
    "yard"
    "bell"
    "ben"
    and in my order (without sorting by lenght) it appears like:
    apartament, yard, bell, ben, house, cup.
    if i put selected data in sectors, by which case it was selected, it would look like this:
    (1 order): apartament, yard, ball
    (2 order): bell, ben
    (3 order): house, cup
    and i need to sort them by length in DESC order, so it should look like this:
    (1 order): ball, yard, apartament.
    (2 order): ben, bell.
    (3 order): cup, house.
    so all selected data should appear like:
    ball, yard, apartament, ben, bell, cup, house.
    how to do that with case and order by length?
  4. Hello guys, i need some experienced info here.. i need to sort selected data, thats why i used case like:

    SELECT * FROM Customers ORDER BY CASEWHEN CustomerName LIKE '%a%' THEN 1WHEN CustomerName LIKE '%b%' THEN 2ELSE 3END

    Everythings fine here, but I need to sort each sector (1, 2 and 3) seperately by CustomerName`s lenght. How to do that?

    any ideas ?

×
×
  • Create New...