Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. You can do magic with SUBSTRING_INDEX and POSITION, but I'm not sure you want to.
  2. You can use REGEXP -- but it won't be very efficient.
  3. Duplicate should be referring to individual field values, not parts of a field -- storing delimited data that you need to consider separately is likely going to bite you soon enough, if it hasn't already. There's all sorts of tomfoolery you can do with FIND_IN_SET(), but I don't recommend it.
  4. Very difficult to tell what you're fererring to -- but I'm assuming that your PHP code isn't actually *making* a table -- DML vs DDL matters.
  5. Welcome back... it's been a while, but I'm still here ;-)
  6. Assuming it truly goes into the "same dropdown", you might get away with some version of UNION.
  7. I'm not certain LAST_INSERT_ID() is meaningful after that last SELECT -- why do you need to get the values you just inserted? Why not do with inside a function?
  8. Are you getting that error in the replication thread?
  9. Start by posting the actual code for the SP.
  10. Well, this is the problem -- the DBs need to begin in an identical state in order to begin replication.
  11. How did you set up the slave DB to beginwith?
  12. fenway

    ID to GUID

    Why do you want to do this?
  13. Here's to more active gurus!
  14. It appears as though you're describing a mysterious tool that you didn't write.
  15. FYI, if you're truly using comma-seperated values, FIND_IN_SET() can help too -- not that I recommend this approach.
  16. fenway

    join rows

    This is screaming for normalization, but this will work (link to http://sqlfiddle.com/#!2/30c2b/1/0): select id , IFNULL(group_concat(year1),0) as `Year 1` , IFNULL(group_concat(year2),0) as `Year 2` , IFNULL(group_concat(year3),0) as `Year 3` from ( select id , IF(year1,score,null) as year1 , IF(year2,score,null) as year2 , IF(year3,score,null) as year3 from scores ) t1 group by id; Obviously, depending on how you want duplicates and sorting, you'll need to tweak the group_concat() call slightly.
  17. We can use all the active gurus around here.
  18. 1. I see no reason to not use DECIMAL -- no need to worry about floating-point errors in recent versions of MySQL. 2. Never store formatted data -- you can always format it on the way out.
  19. Why not just select topic, sub_topic?
  20. Also, it's rare that you need the exact distance -- pythagoras does a better faster job anyway. You can't drive straight-line distance anyway.
  21. Sure, you can query a database for a column value -- but I'm assuming your question is more complicated than that? Please elaborate.
×
×
  • 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.