Search SQL Question Between Related Two Tables
- by mTuran
Hi, I am writing some kind of search engine for my web application and i have a problem. I have 2 tables first of is projects table:
PROJECTS TABLE
id      int(11)     NO  PRI     NULL    auto_increment
employer_id     int(11)     NO  MUL     NULL     
project_title   varchar(100)    NO  MUL     NULL     
project_description     text    NO      NULL     
project_budget  int(11)     NO      NULL     
project_allowedtime     int(11)     NO      NULL     
project_deadline    datetime    NO      NULL     
total_bids  int(11)     NO      NULL     
average_bid     int(11)     NO      NULL     
created     datetime    NO  MUL     NULL     
active  tinyint(1)  NO  MUL     NULL     
PROJECTS_SKILLS TABLE
project_id      int(11)     NO  MUL     NULL     
skill_id    int(11)     NO  MUL     NULL     
For example: I want ask this query to database:
1-) Skills are 5 and 7.
2-) Order results by created
3-) project title contains "php" word.
4-) Returned rows should contain projects.* columuns.
5-) Projects should be distinct(i don't want same projects in return of query).
Please write sql query that ensure these conditions. Thank You.