Questions tagged [relation]

A relation on sets S1, S2, ..., SN is any subset of S1 x S2 x ... x SN, where 'x' denotes the Cartesian product. In other words, a relation over N sets is any set of ordered N-tuples over the N sets.

A relation on sets S1, S2, ..., SN is any subset of S1 x S2 x ... x SN, where 'x' denotes the Cartesian product. In other words, a relation over N sets is any set of ordered N-tuples over the N sets.

1457 questions
5
votes
1 answer

yii2 adding '0=1' to query on many to many relation

I have a project where users must be connected with each others - like friends. So i decided to connect them by the table 'connect'. Looks like it's rights. But when i tried to search for a friend requests i got the error, described below. Here is…
5
votes
3 answers

how to display relation data into json format from two table in yii2 restful api

I got the problem to display the data from two table into JSON format and working on yii2 restful api. this is my structure database: TABLE `volunteer`( `volunteer_id` int(11) NOT NULL auto_increment, `state_id` int(11) null TABLE…
shahril
  • 159
  • 2
  • 10
5
votes
1 answer

Starter question of declarative style SQLAlchemy relation()

I am quite new to SQLAlchemy, or even database programming, maybe my question is too simple. Now I have two class/table: class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String(40)) …
jfding
  • 635
  • 1
  • 7
  • 8
5
votes
0 answers

Exactly How Do We Export And Then Import Parse Objects With Relations?

I want to archive my Parse database. It has a class with a column that is a many-to-many relation. When I export I get a _Join table file. But I can not find any explanation how to import the _Join table file so that I can restore the column data…
5
votes
2 answers

Prolog repeating solutions on symmetric relations

Consider this small program: married(bill, hillary). spouse(X, Y) :- married(X, Y); married(Y, X). likes(X, Y) :- spouse(X, Y). Now I want to evaluate a goal ?- likes(X, Y). X = bill Y = hillary ?; X = hillary Y = bill yes Is there a way to…
tcigler
  • 126
  • 8
5
votes
3 answers

Yii count model with relation

I have a model Aziende, that is related (1:N) to anther model called Annunci, like this: 'annunci' => array(self::HAS_MANY,'Annunci','azienda_id'), I would like to count how many record does really have this relation, in mySql I will do: SELECT…
teone
  • 2,153
  • 3
  • 25
  • 49
5
votes
2 answers

applying a default scope with reference to a relation in yii

I can't find too much documentation on applying a default scope to a model in yii, I was wondering if someone could explain or point me in the right direction. The quick version of my question: Is it possible to add a relation to a default scope, or…
Stu
  • 4,160
  • 24
  • 43
4
votes
1 answer

Hibernate 3.6.7: Problem with @ANY and Foreign-Key

I have the entities "User" and "Customer": @Entity @Table(name = "USR_USER") public class User extends PersistentObject { [...] @Any(metaColumn = @Column(name = "USR_OWNERTYPE")) @AnyMetaDef(idType = "long", metaType = "string",…
Thomas777
  • 41
  • 1
4
votes
3 answers

Use own tuples in JOIN statement

is it possible use own tuples as a source for an JOIN statement? Here is an example of what I'm looking for: SELECT u.id, u.name FROM users u INNER JOIN {{tupl1},{tupel2},{tupel3},...}
lszrh
  • 1,531
  • 1
  • 19
  • 28
4
votes
3 answers

Doctrine Class "..\.." has no association named "..."

I hope you can help me with this problem because I really cannot see what is wrong here. I have 2 entities: RokZaPrijavuProjekta AND Predmet. RokZaPrijavuProjekta: /** * @ORM\Table(name="rok_prijava_projekta") *…
Jovan Perovic
  • 19,846
  • 5
  • 44
  • 85
4
votes
1 answer

Many to Many, with another column

I'm wondering if anyone has faced this issue. Let's assume I have two tables: products and carts (related many to many). Now, joining table has additional column - amount (how many products of particular type is in the cart). My problem is that I…
mailo
  • 2,601
  • 22
  • 19
4
votes
2 answers

Doctrine ORM Conditional Association

i'm building a Q&A site and my questions, answers and comments are on the same posts table. But their postType is different. I can get answers for a question and comments for an answer with this association: /** *…
cnkt
  • 2,943
  • 5
  • 30
  • 43
4
votes
1 answer

How to get data with hasMany relation and hasMany in laravel?

I have Two table (projects, tasks). projects table structure looks like this: id - title - desc - others_column 1 - title - desc - others 2 - title - desc - others tasks table structure looks like this: id - title - desc - project_id - parent_id…
Rakibul Hasan
  • 460
  • 4
  • 13
4
votes
1 answer

Wrong fieldname in query with Criteria and Many-To-Many-Relation

When I try to use a simple Criteria on a property with a different columnname in Many-To-Many-Relation, Doctrine uses the propertyname as the field and not the columnname. Person ORM Definition ... manyToMany: attributes: targetEntity:…
Sebus
  • 3,752
  • 3
  • 14
  • 22
4
votes
1 answer

Hibernate Search and Relations

I have an object called MyItemBean which can have 0 or more associated KeywordBean objects. The resulting classes look like this: @Entity public class MyItemBean { ...stuff... @ManyToMany(targetEntity = KeywordBean.class, cascade =…
Shadowman
  • 11,150
  • 19
  • 100
  • 198