General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
>select distinct rep, .t. as SA_flag from myTable ; where pub = "SA" ;union ;
select distinct rep, .f. as SA_flag from myTable ;
where rep not in (select distinct rep from myTable where pub="SA") ;order by 1
Assuming a significant size "myTable", how would that statement compare with:
Select distinct rep, .t. as SA_Flag from myTable where pub="SA";
union;
Select distinct rep, .f. as SA_Flag from myTable where NOT (pub="SA")
It seems the first statement would be querying the same set twice.
I thought there was an "in-line" way to get a unique value from a group, but i guess the two-step union will work (almost) as effectively.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only