You are here: Re: How to select fields form two tables, where one is containing some text+field form other table+some text « PHP SQL « IT news, forums, messages
Re: How to select fields form two tables, where one is containing some text+field form other table+some text

Posted by J.O. Aho on 10/01/07 16:46

filipwitczak@gmail.com wrote:
> I have a problem - I need to select fields from two tables, where
> field form table1 contains text + table2.id + text.

This is quite easy

SELECT * FROM table1
INNER JOIN table2 ON(table1.commoncolumn=table2.commoncolumn)
WHERE column='something'


> I have table reservations which has clients field. clients contains
> client's id (taken from table2) with client's options. It's syntax is
> like
>
> |61=[49!130]&[50!15]|62=[49!130]&[50!15]|
> where each |client.id=[option.id!value]&[option.id!value]|

You are using a data structure that is better fit for flat line storage of data

SQL table would look like

client_id, option_id, option_value

And you have one row for each option.

If you redesign your database, things will get a lot easier


--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация