MySQL queries needed
This project received 17 bids from talented freelancers with an average bid price of $26 USD.Get free quotes for a project like this
Project Budget$30 - $100 USD
I have five queries that I need help creating.? I have a database with multiple tables linked to a core table and have to select a subset of the main table but order it by a field in one of the linked tables.
Let's assume I have a table called 'main' and a related table called 'notes'.? There is a field [url removed, login to view] that is linked to a field notes.id.? In 'main' 'id' is a unique value, but in 'notes' 'id' is not the index, but just a reference to the value in 'main'.? 'main' has a large number of fields in addition to 'id' that I need to be able to access from the query.? 'notes' has additional fields 'datetime', 'entered_by', 'entry1', 'entry2' and 'entry3'.? A given row of 'notes' will have values for 'id', 'datetime', 'entered_by' and one of the three entry fields, but never for more than one of the entry fields per row.
Query1:? I need to select rows from 'main' where [url removed, login to view] is not an empty field (i.e. is the one of the three entry fields with a value) and order the rows? by the most recent [url removed, login to view] value for each [url removed, login to view] .? The result of the query will be iteratively displayed ( but you won't be coding this, I already have.? I just need the Select statement? written).
There is a table 'users' that has the fields 'username' and? 'userclass'.
Query2: I need to run Query1, but where the username value in the notes.entered_by field has a userclass of "Admin".
In addition to the 'notes' table, I have a 'status' table that has the fields 'id', 'status', and datetime.
Query3: I need to select rows from 'main' where? the most recent 'status' associated with [url removed, login to view] has a [url removed, login to view] value of more than 5 days before now and sort the rows from 'main' from the oldest [url removed, login to view] to the most recent.
Query4: I need to have a true/false output for a search of a given [url removed, login to view] about whether the most recent [url removed, login to view] is over 5days old or not.
There is a fourth table 'questions' with the fields 'id', 'question', and 'answer'.?
Query5: I need to select all rows in? 'main' where there are 'questions' associated with [url removed, login to view] that have no 'answer'.
* * *This broadcast message was sent to all bidders on Saturday Mar 20, 2010 3:22:23 AM:
Thank you for your bids. I have selected the bidders I wish to work with at this time.
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online