Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is MAX() a good choice where GROUP BY?
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Is MAX() a good choice where GROUP BY?
Miscellaneous
Thread ID:
01676115
Message ID:
01676115
Views:
59
Hi,

I am writing a SQL Select with a group by. The SQL Select has JOIN and some fields from the Joined table are to be selected. I can include them into the SQL Select using the MAX() clause. For example,
select Table1.Field1, max(table2.Field1) as FieldXyz, max(table2.Field2) as FieldAbc from Table1 
join Table2 on Table1.pk_field = Table2.pk_field group by table1.Field1
The above works. But I wonder if I should avoid using MAX() and come up with a different way of getting the fields from Table2?

TIA
"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
Next
Reply
Map
View

Click here to load this message in the networking platform