Can I redesign this MySQL table?
See my last posts:
- How to determine if a MySQL query is valid?
- MySQL join left
How can I redesign the tables? I mean which things should be changed? Also, how about if I make two queries as follows?
Query 1:
Select from Table one where column1 = 'smith' OR column2 = 'smith' AND status=1
Then with help of PHP I get the value
if($result['column1']=='smith') {
$getValue = $result['column2'] }
else { $getValue = $result['column1'] }
Query2:
Selec开发者_如何学Ct from Table2 where column1 = '$getvalue' OR column2 = '$getvalue'
Is this is good approach or should I redesign the tables? If I should redesign, can you please tell me what changes I should make?
Perhaps you can post the CREATE TABLE statements or the goal you are trying to achieve?
It seems like normalization could help a lot - in detail this may be answered with more details about the actual content / semantics...
精彩评论