1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

SQL, getting the same results for both LOWER and UPPER

Discussion in 'Databases' started by mads, Oct 17, 2012.

  1. #1
    Hi,

    I have this SQL statement:
    SELECT DISTINCT type, COUNT(type), LOWER(price), UPPER(price) FROM products WHERE system = 'abc' GROUP BY type ORDER BY type

    Problem is that LOWER and UPPER give me the same results - but when I look at the date, the results should be different.

    Any idea what is wrong with the statement and how I can fix it, so I get different results for LOWER and UPPER? (i.e. the lowest price for the type and the highest price for the type)

    Thanks,
    Mads
     
    mads, Oct 17, 2012 IP
  2. iliveforyou

    iliveforyou Active Member

    Messages:
    207
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    LOWER and UPPER are used like:
    select LOWER('AAA') from table --> result: aaa
    select UPPER('bbb') from table --> result: BBB
    In your case you have numbers, you can use min(price) and max(price).
     
    iliveforyou, Oct 28, 2012 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Edit...

    What you're doing makes no sense. As stated above, LOWER and UPPER are character functions. Also, DISTINCT and GROUP BY are performing the same function in your example. Get rid of the DISTINCT. What are you trying to accomplish?
     
    jestep, Oct 31, 2012 IP
  4. Trusted Job

    Trusted Job Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi
    i have server load problem and the server provider or automatically website use to stop any body can help me
     
    Trusted Job, Nov 6, 2012 IP
  5. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #5
    Not with the limited amount of information you gave us.
     
    Rukbat, Nov 6, 2012 IP
  6. crankbonkers

    crankbonkers Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Can any one explain me about the inner queries how they work.Explain about the joins too?
     
    crankbonkers, Nov 26, 2012 IP
  7. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125