Jump to content
php.lv forumi

search query


localkaste

Recommended Posts

sveiki.

 

netieku galā ar vienu meklēšanas query :(

ceru uz palīdzību šajā forumā!

 

tātad pati problēma!

 

sql tabulu struktūra:

 

create table if not exists products (
id mediumint(8) unsigned auto_increment primary key,
name varchar(300),
price double
) engine=innodb;

create table if not exists attributes (
id mediumint(8) unsigned auto_increment primary key,
name varchar(300)
) engine=innodb;

create table if not exists attribute_values (
id mediumint(8) unsigned auto_increment primary key,
attribute_id mediumint(8) unsigned,
name varchar(300)
foreign key (attribute_id) references attributes(id) on delete cascade
) engine=innodb;

create table if not exists checked_attributes (
product_id mediumint(8) unsigned,
attribute_value_id mediumint(8) unsigned,
foreign key (product_id) references products(id) on delete cascade,
foreign key (attribute_value_id) references attribute_values(id) on delete cascade
) engine=innodb;

 

products: produktu dati

attributes: produkta atribūti

attribute_values: produkta atribūta vērtības

checked_attributes: šeit glabājas id ar atķeksētajiem produkta atribūtiem

 

un meklēt vajadzētu gan gan produktu nosaukumos: products->name, gan atribūtos attributes->name, bet tikai tādos kuri ir atķeksēti: checked_attributes tabulā.

 

paldies jau iepriekš ;)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...