Jump to content

smn

New Members
  • Posts

    9
  • Joined

  • Last visited

smn's Achievements

Member

Member (2/5)

0

Reputation

  1. Good morning! I've googled the question, but could not find the information. There is a <table> with random number of <td>s (each <tr> contains 3 <td>s). How to reverse the order of each <td> in this table? The initial order is: <table><tr><td1></td><td2></td><td3></td></tr> <tr><td4></td><td5></td><td6></td></tr></table> I need: <table><tr><td6></td><td5></td><td4></td></tr> <tr><td3></td><td2></td><td1></td></tr></table> Would appreciate any assistance or idea!
  2. It works! Thank you very much, Barand! Thank you very much, kicken! Great!
  3. Same result. And it doesn't matter what I include in REPLACE: REPLACE (price, '&nbsp','') or REPLACE (price, ' ','') or REPLACE (price, '194','') or even REPLACE (price, HEX(C2),'') This was with CAST, without CAST those queries return just the same that is in the price column
  4. As far as I can assume, C2 is an " " hex symbol. So should I try: REPLACE (price, ' ', '')
  5. hexprice 3133C2A0393539 3136C2A0313137 3331C2A0363939 3138C2A0313537 3231C2A0363136 38C2A0373931 3335C2A0303339 3138C2A0373935 3238C2A0373231 3132C2A0363938 3130C2A0313836 3137C2A0313130 39C2A0333734 3135C2A0313332 3134C2A0393230 38C2A0373931 3238C2A0373231 3137C2A0343039 3230C2A0373333 38C2A0303832 3238C2A0373231 3136C2A0303233 3331C2A0353235 3132C2A0323537 39C2A0383233
  6. Might that be because of the different encoding for TEXT field? (It is UTF8, but may be filled with digits as cyrillic letters)
  7. No, I've tried this one, but the result is the same. Table name is different, I've changed it. Do you try the query on MySQL? First, I thought that something was wrong in PHP code, but now I'm checking directly in PHPMyAdmin. And there is no error notes in it. As we can see, REPLACE operator doesn't work correctly, it doesn't remove spaces. It just returns values. I don't know why there are TEXT (not INT or DECIMAL). I was just given this task without permission to change the table fields
  8. Excuse me, this is the correct one: SELECT price, CAST(REPLACE(price,' ','') AS signed) FROM table ORDER BY CAST(REPLACE(price,' ','') AS signed)
  9. There is a table with prices (TEXT), I need to sort it as INT. And there is a space in the middle of it. So I use REPLACE for removing spaces and CAST for switching to signed INT. This query: SELECT price, CAST(REPLACE(price,' ','') AS signed FROM table ORDER BY CAST(REPLACE(price,' ','') AS signed) Returns this: price CAST (price AS signed) 8 791 8 8 791 8 8 082 8 9 374 9 9 823 9 10 186 10 12 698 12 12 257 12 13 959 13 14 920 14 14 463 14 15 132 15 16 117 16 16 023 16 16 606 16 It sorts digits before a space, but do not return the whole price. I need to sort it correctly. Please help me with this query or at least give me a hint!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.