mysql - how to apply join query using SQL -
i have 2 tables in mysql database.
the first table 'property' columns (id(pk), title, description, status)
the second table 'object_property' in relations between object , property stored , relation value, having columns (id(pk), object_id, property_id(fk reference column 'id' of property table), value)
now want extract result of properties 'property' table relation doesn't exist in 'object_property' table.
i need write sql join query this...
can me out? new sql.
thanks!
if writing raw query run directly in mysql use following left join
:
select p.* property p left join object_property op on p.id = op.property_id op.property_id null
if writing query in hql, dealing entities (java pojos) representing tables, rather tables themselves. can offer following hql query:
from property p left join p.objectproperty op op null
this assumes have class called property
represents property
table. assumes object_property
table has entity class objectproperty
, , property
has reference objectproperty
.
Comments
Post a Comment