formulahendry / formulahendry/vscode-mysql

Selecting and joining tables where columns have the same name

Open
#154 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
229
Forks
58
PR merge metrics
No merged PRs in 30d

Description

So if I have two tables for example that both have name, when selecting and joining these two the second table name overwrites the first.

`select recipes.id, recipes.name, recipes.prep_time, recipes.main_ingredient, ingredients.name
from recipes join ingredients on recipes.main_ingredient = ingredients.id;`

ingredients
id| name| category| calories| unit
--|-------|--------|---|-----
1| apple| fruit| 50| item
2| peach| fruit| 50| item
3|chicken| poultry| 95| oz

recipes
id| name| prep_time| main_ingredient
--|----------------|--|-
1| Chicken Alfredo| 30| 3

result
id| name| prep_time| main_ingredient
--|--------|--|-
1| chicken| 30| 3

expected
id| name| prep_time| main_ingredient| name
--|------------|----|--|----------
1| Chicken Alfredo| 30| 3| chicken

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.