Valentina DB

Hello again… :slight_smile:
Sorry for bothering you with this, probably small thing, but I have no idea how to solve it. I started working with Valentina db couple days ago. I am using SQLSelect and sending query to get records from table in VCursor. But I don’t know how to add query and get just linked records. For example, I have 2 tables, A and B. I want to get all records from table B which are linked with one record in table A. As you can see, I am newbie in this, but I am hoping someone will understand what I need.

Than you. :slight_smile:
Aleksandar

Read up on joins here: http://www.w3schools.com/sql/sql_join.asp

Then show us your code if it doesn’t work. In Valentina Studio you can create queries visually. But setting up a join was very painful the last time I tried.

Still nothing… :frowning:

I think query should start like this:

SELECT ** FROM tableA LEFT JOIN tableB ON

But I have no idea how to search records from tableA which are linked with selected record in tableB. :frowning:
Hating and avoiding SQL became my worst nightmare.

You only hate SQL because you don’t have practice.

A full join automatically does what you want. So leave out the “left”:

SELECT ** FROM tableA JOIN tableB on tableA.RecID = tableB.ForeignKey

You need to exchange ForeignKey with your key in tableB.

you don’t have to use joins etc. for valentina, it has a really nice sql interpreter with some extas tools in hand…

SELECT ** FROM tblA is enough…

As long has you have set up the tables with object pointers (Links) from table A to table B

Then joins is not necessary any more.

it even has a pointer operator…

select f1, f2, f3->f1 as newName FROM tbl1

this will also get f1 from tbl2 if f3 is a object pointer to tbl2 . If you don’t have to be 100% SQL grammar right… then valentina offers much simpler sql for doing the same…

I’m lazy, and I don’t want all the extra JOINS etc… :slight_smile:

Thank you Beatrix. :slight_smile:

I am using Binary Links for now. I guess I need to change it. Its very new for me, but trying to understand this. Yes, I need a lot of practice, but there’s no enough time to do it normally.

Thank you Helgde. :slight_smile:

I already said this is new for me, so I am trying to understand everything you wrote. :slight_smile: But, after all, I am optimist, and going to learn all this as soon as possible :slight_smile:
Lazy too :smiley: Some tells it is problem, but others thinks it is advantage :smiley: