Find Jobs
Hire Freelancers

Complex MySQL help needed

$30-100 USD

Completed
Posted about 13 years ago

$30-100 USD

Paid on delivery
I have a complex MySQL query that I need help with. I have limited understanding of MySQL, so I'm going to explain in English what I need. Let me know if you have any questions. Basically I need to get values from three tables, where the values selected from the second/third table depend on the first. The three tables are: TableUsers / TableFieldValues / TableURL TableUsers: This table has several columns. Column userID is the unique/index. ......Select userID, username, displayname, photonum TableFieldValues: This table has 3 columns of interest ('item_id' / 'field_id' / 'item_field_value'). There is no unique/index. The column 'item_id' corresponds to 'userID' of the first table. ......For each of the TableUsers results (from first table), look within all rows of TableFieldValues where ([login to view URL] = [login to view URL]). Remove from query any userID/item_id where the field_id='25' AND item_field_value<>'US' Then select: [item_field_value where field_id='15' / as City], [item_field_value where field_id='19' / as Street], [item_field_value where field_id='16' / as Postal]. WHERE Postal>94030 (remove from query any results that are less than 94030). TableURL: The three important columns here are 'parent_file_id', 'type', and 'imgURL' ….. Find the single row where ([login to view URL] = [login to view URL]) AND (type.TableURL='thumbicon'). Then select the value of imgURL from that row. Once those results are collected, I want to display all results with photonum>0 first, and photonum=0 after that. However, I do not want to orderby photonum beyond that. Rather, I want to ORDER BY Postal ASC. I want to display the results on a page like: $userID - $username - $displayname - $city - $street - $postal - $imgurl $userID - $username - $displayname - $city - $street - $postal - $imgurl $userID - $username - $displayname - $city - $street - $postal - $imgurl Since I am using PHP, I would like the MySQL statement provided with the needed PHP code. Hope that all makes sense. Please let me know if you have any questions. In your bid, please let me know how long it will take you to provide the code.
Project ID: 3183734

About the project

4 proposals
Remote project
Active 13 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
Awarded to:
User Avatar
See private message.
$34 USD in 14 days
5.0 (81 reviews)
6.6
6.6
4 freelancers are bidding on average $48 USD for this job
User Avatar
See private message.
$46.75 USD in 14 days
5.0 (441 reviews)
6.6
6.6
User Avatar
See private message.
$51 USD in 14 days
5.0 (143 reviews)
5.8
5.8
User Avatar
See private message.
$59.50 USD in 14 days
4.7 (9 reviews)
2.9
2.9

About the client

Flag of UNITED STATES
San Francisco, United States
5.0
216
Payment method verified
Member since Jul 22, 2002

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759) & Freelancer Online India Private Limited (CIN U93000HR2011FTC043854)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.