Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is MAX() a good choice where GROUP BY?
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01676115
Message ID:
01676131
Views:
45
>>>Here is an example:
>
>*-- Table1
>*-- Strucutre:
>FIELD1     FIELDX    FIELDY
>2
>4
>2
>2
>1
>4
>4
>
>*-- Table 2
>*-- Structure
>FIELD1     FIELD2    FIELD3
>1               'ABC'      '123'
>2               'XYZ'      '456'
>3              'DFD'      '333'
>4              'DDF'      '444'
>
>*-- Resulting query should be
>FIELD1     FIELD2     FIELD3
>1               'ABC'      '123'
>2               'XYZ'      '456'
>4              'DDF'      '444'
>
>>>
>>>Now that I wrote the example, above, I think I can SELECT from Table2 and JOIN Table1 on FIELD1.
>
>
>I think you do not even need a join for this, you can just select the records from Table2 that have a FK in Table 1, like:
>
>
>SELECT Field1, Field2, Field3 FROM Table2 WHERE Field1 IN (SELECT Field1 FROM Table1)
>
>
>As you are not using the FieldX and FieldY at all

The real case (my example is somewhat simplified) is more involved. But maybe what you suggest is what I need.
Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform