Results 1 to 2 of 2

Thread: mysql query problems

  1. #1
    Funking Prink! Raz316's Avatar
    Join Date
    Jul 2003
    Location
    Deal, Kent, UK
    Posts
    2,978
    Thanks
    130
    Thanked
    62 times in 52 posts

    mysql query problems

    Code:
    SELECT t . * , sp.system_postcode_postcode, (
    SQRT( (
    ( 5607 - sp.system_postcode_east ) * ( 5607 - sp.system_postcode_east ) ) + ( ( 2598 - sp.system_postcode_north ) * ( 2598 - sp.system_postcode_north ) )
    ) /22
    ) AS chris_dist
    FROM another_table t
    LEFT JOIN system_postcode sp ON sp.system_postcode_postcode = t.another_table_postcode
    LIMIT 30
    The above works fine return results as expected

    Code:
    SELECT t . * , sp.system_postcode_postcode, (
    SQRT( (
    ( 5607 - sp.system_postcode_east ) * ( 5607 - sp.system_postcode_east ) ) + ( ( 2598 - sp.system_postcode_north ) * ( 2598 - sp.system_postcode_north ) )
    ) /22
    ) AS chris_dist
    FROM another_table t
    LEFT JOIN system_postcode sp ON sp.system_postcode_postcode = t.another_table_postcode
    ORDER BY chris_dist
    LIMIT 30
    This one doesn't return any errors, but the 'sp.system_postcode_postcode' field and the 'chris_dist' field appear as NULL. Why would the ORDER BY part make fields null out?

    Im confuzzled : /

  2. #2
    bored out of my tiny mind malfunction's Avatar
    Join Date
    Jul 2003
    Location
    Lurking
    Posts
    3,923
    Thanks
    191
    Thanked
    187 times in 163 posts
    • malfunction's system
      • Motherboard:
      • Gigabyte G1.Sniper (with daft heatsinks and annoying Killer NIC)
      • CPU:
      • Xeon X5670 (6 core LGA 1366) @ 4.4GHz
      • Memory:
      • 48GB DDR3 1600 (6 * 8GB)
      • Storage:
      • 1TB 840 Evo + 1TB 850 Evo
      • Graphics card(s):
      • 290X
      • PSU:
      • Antec True Power New 750W
      • Case:
      • Cooltek W2
      • Operating System:
      • Windows 10
      • Monitor(s):
      • Dell U2715H

    Re: mysql query problems

    Me too... Looks like a bug rather than anything you're doing (though I've no idea what you're doing with that query)... Does "order by 2", "order by 1" or "order by sp.system_postcode_postcode" work OK? (also - have to say - who's coming up with those field names? "postcode_postcode" ?)

    Also - I'm assuming there's a 1:1 mapping between t.another_table_postcode and sp.system_postcode_postcode - i.e. there's no "group by" required

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problems with Abit Netherlands Tech Support.
    By CJShielder in forum abit.care@HEXUS
    Replies: 4
    Last Post: 18-04-2008, 09:24 AM
  2. MySQL extension for PHP 5.2.3 not working
    By Jerrythafast in forum Help! Quick Relief From Tech Headaches
    Replies: 18
    Last Post: 13-06-2007, 08:03 PM
  3. Problems with new machine
    By kasavien in forum SCAN.care@HEXUS
    Replies: 5
    Last Post: 31-01-2006, 01:48 PM
  4. Making PHP and MySQL Talk?
    By Dav0s in forum Software
    Replies: 4
    Last Post: 18-09-2005, 10:53 PM
  5. Troubleshooting - Software & Driver problems
    By Steve in forum Help! Quick Relief From Tech Headaches
    Replies: 0
    Last Post: 09-07-2004, 06:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •