Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Combining two tables using SQL-SELECT

Combining two tables using SQL-SELECT

Combining two tables using SQL-SELECT

I have two tables with the same record structure : ENTS with 1235 records and ARCS with 16,800 records. How can I use SELECT SQL to create a single cursor with all 18035 records.

I realise there is some information in the VFP Help files, but if anyone has written or can recommend a short guide to the very basic features of SELECT-SQL in VFP, with a a few simple examples, that would be very helpful.

Thanks - Andrew Mozley

RE: Combining two tables using SQL-SELECT




RE: Combining two tables using SQL-SELECT

Thank you very much, mJindrova - Andrew

RE: Combining two tables using SQL-SELECT

You explicitly asked for SQL, and there's nothing to add to that.

I welcome the interest in SQL, but what's more important in a datbase system than the discussion about xbase commands vs sql is that same structured data points out it should be in one table, so why would you not merge the tables by APPEND? You could append one to the other table. The two names point out that one group of records is about different things. I don't think you mean Ents from the world of Lord of the Rings, but if there is a general difference between the one and the other then you could record that in a new logical field.


RE: Combining two tables using SQL-SELECT

You might not use append if the structures were different - you could end up with just a bunch of blank records or ruin
the referential integrity if you had duplicate keys.


Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0

RE: Combining two tables using SQL-SELECT

Good advice, at least about the duplicate keys.

Quote (AndrewMozley)

I have two tables with the same record structure

Well, when you want to add a field like lArc .T. for all ARCS records and .F. foir all ENTS, you'd create an empty table with that field as last field, DEFAULT .F. or no default, which causes .F. as default anyway, no primary key constraint, append in the ARCS records and REPLACE ALL lArc WITH .T., then append all ENTS records. And finally either renumber all IDs, if there is such a field or introduce one and add in the primary key constraint or candidate key for free tables can have no primary key constraint.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close