Hi,
I have 2 tables which are they students and users.
I have a form. That I am recording form details in students table.
student table includes
id - name - surname - email
When I approve students request, I copies from students table to users table.
users table includes same fields as students.
I can add add a field to students or users like status and giving them 0 or 1 data to checking it's approved or not. But I have a search page too, so I want to search it quickly, It would be lots of datas on students table.
Am I on right way?
My question is how can I make search on 2 tables in same time?
Thank you.
Searching in 2 tables.
Moderator: General Moderators
Re: Searching in 2 tables.
If both tables have the same fields then it will be wise to have just one table and do as you said:
I don't understand this though:I can add add a field to students or users like status and giving them 0 or 1 data to checking it's approved or not.
But I have a search page too, so I want to search it quickly, It would be lots of datas on students table
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Search two tables at once:
But you would be best to use one table to store all the info as you suggest. Dont worry about having lots of entries in the table...it will still be fairly fast.
Code: Select all
SELECT table.id, table.name, table2.id, table2.name FROM table, table2 WHERE table.id = '5' AND tablo.id = table2.id