Guides
AsOf Joins with the `USING` Keyword
So far we have been explicit about specifying the conditions for AsOf,
but SQL also has a simplified join condition syntax
for the common case where the column names are the same in both tables.
This syntax uses the `USING` keyword to list the fields that should be compared for equality.
AsOf also supports this syntax, but with two restrictions:  
* The last field is the inequality
* The inequality is `>=` (the most common case)  
Our first query can then be written as:  
```sql
SELECT ticker, h.when, price * shares AS value
FROM holdings h
ASOF JOIN prices p USING (ticker, "when");
```  
#### Clarification on Column Selection with `USING` in ASOF Joins {#docs:guides:sql_features:asof_join::clarification-on-column-selection-with-using-in-asof-joins}  
When you use the `USING` keyword in a join, the columns specified in the `USING` clause are merged in the result set. This means that if you run:  
```sql
SELECT *
FROM holdings h
ASOF JOIN prices p USING (ticker, "when");
```  
You will get back only the columns `h.ticker, h.when, h.shares, p.price`. The columns `ticker` and `when` will appear only once, with `ticker`
and `when` coming from the left table (holdings).  
This behavior is fine for the `ticker` column because the value is the same in both tables. However, for the `when` column, the values might
differ between the two tables due to the `>=` condition used in the AsOf join. The AsOf join is designed to match each row in the left
table (` holdings`) with the nearest preceding row in the right table (` prices`) based on the `when` column.  
If you want to retrieve the `when` column from both tables to see both timestamps, you need to list the columns explicitly rather than
relying on `*`, like so:  
```sql
SELECT h.ticker, h.when AS holdings_when, p.when AS prices_when, h.shares, p.price
FROM holdings h
ASOF JOIN prices p USING (ticker, "when");
```  
This ensures that you get the complete information from both tables, avoiding any potential confusion caused by the default behavior of
the `USING` keyword.