| | |
Mysql Join help
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2007
Posts: 10
Reputation:
Solved Threads: 0
Hi
Im not sure if i need a join here, i cant seem to grasp the concept of joins really batteling with this
I allocate points to id numbers in the points table and i have a list of all id numbers in the consultants table
the id numbers only exist in the points table if points where allocated to them
I would like to be able to see what consultants did not earn any points in a specific date range eg a month. so I would like a list of all the missing Id numbers in the points table for a specific month
this only shows me the consultants that have points in the month
I would really appreciate some help
Im not sure if i need a join here, i cant seem to grasp the concept of joins really batteling with this
I allocate points to id numbers in the points table and i have a list of all id numbers in the consultants table
the id numbers only exist in the points table if points where allocated to them
I would like to be able to see what consultants did not earn any points in a specific date range eg a month. so I would like a list of all the missing Id numbers in the points table for a specific month
MySQL Syntax (Toggle Plain Text)
SELECT consultants.name , consultants.surname , consultants.cell_number , consultants.id_number FROM consultants LEFT OUTER JOIN ( SELECT id_number FROM points WHERE date_added BETWEEN '2008-01-01' AND '2008-01-30' GROUP BY id_number ) as pts ON pts.id_number = consultants.id_number
this only shows me the consultants that have points in the month
I would really appreciate some help
•
•
Join Date: Jun 2008
Posts: 79
Reputation:
Solved Threads: 8
Try this
MySQL Syntax (Toggle Plain Text)
SELECT consultants.name , consultants.surname , consultants.cell_number , consultants.id_number ,points.id_number FROM consultants LEFT OUTER JOIN points on points.id_number = consultants.id_number AND date_added BETWEEN '2008-01-01' AND '2008-01-30' HAVING points.id_number IS NULL
:- Varma
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
We are Happy to inform launch of a new site with loads of database related information Site offers wide range of functionality Forums,Blogs,Articles,Editorials and much more
http://www.sqllibrarian.info/
![]() |
Similar Threads
- Optimize, Fix MySQL Join Query (PHP)
- MySQl Join Help Needed! (MySQL)
- Required Sr. MySQL DBA & Instructor, India (Software Development Job Offers)
- How do i get ppl to join my forum (Website Reviews)
- MySql multiple table query problem.... (MySQL)
- master database with php mysql (Legacy and Other Languages)
- Invision Power Board mysql error when trying to view newly created forums (PHP)
Other Threads in the MySQL Forum
- Previous Thread: error:when special characters are inserted
- Next Thread: Display mysql data
| Thread Tools | Search this Thread |
agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright count court crm data database design developer development distinct drupal dui ec2 email enter enterprise eudora facebook form foss gartner gnu government gpl greenit groklaw groupware hiring hyperic images innerjoins insert ip joebrockmeier join journalism keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb metron micromanage microsoft microsoftexchange mindtouch montywidenius mozilla music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opendatabasealliance opensource oracle php priceupdating query referencedesign reorderingcolumns resultset saas select sharepoint simpledb sourcecode spotify sql sugarcrm syntax techsupport thunderbird transparency





