Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get 'table name'? #11

Closed
feloxx opened this issue Sep 18, 2018 · 2 comments
Closed

How to get 'table name'? #11

feloxx opened this issue Sep 18, 2018 · 2 comments

Comments

@feloxx
Copy link

feloxx commented Sep 18, 2018

use demo

stmt, err := sqlparser.Parse
fmt.Printf("stmt = %+v\n", stmt)
The output "stmt = &{Cache: Comments:[] Distinct: Hints: SelectExprs:[0xc420088e10] From:[0xc420089110 0xc420089140] Where:0xc42000a5c0 GroupBy:[] Having: OrderBy:[] Limit: Lock:}"

How do I get the value in the From
please help me

@goccy
Copy link
Collaborator

goccy commented Nov 20, 2018

@feloxx
You can get by the following code

fmt.Println(stmt.(*sqlparser.Select).From[0].(*sqlparser.AliasedTableExpr).Expr.(sqlparser.TableName).Name.String())

@feloxx
Copy link
Author

feloxx commented Dec 4, 2018

@goccy thank you

@feloxx feloxx closed this as completed Dec 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants