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

column reference "id" is ambiguous #10

Open
siberiadev opened this issue Nov 25, 2019 · 1 comment
Open

column reference "id" is ambiguous #10

siberiadev opened this issue Nov 25, 2019 · 1 comment

Comments

@siberiadev
Copy link

When I'm trying get data like the code bellow:

let query = knex.select([
		'u.id as _id',
		'u.firstName as _firstName',
		'u.avatar as _avatar',
		'u.lastName as _lastName',
		'u.gender as _gender',
		'u.userStatus as _userStatus',
		'u.dob as _dob',
		'u.email as _email',
		'u.phone as _phone',
		'u.roleId as _roleId',
		'u.password as _password',
		'u.rating as _rating',
		'u.menthorRating as _menthorRating',
		'u.marathonsCompleted as _marathonsCompleted',
		'u.marathonsCreated as _marathonsCreated',
		'u.youtube as _youtube',
		'u.instagram as _instagram',
		'u.createdAt as _createdAt',
		'u.updatedAt as _updatedAt',
		'u.deletedAt as _deletedAt',
		'u.lastName as _user_lastName',
		'm.id as _mar_id',
		'm.title as _mar_title',
		'm.description as _mar_description',
		'm.category as _mar_category',
		'm.price as _mar_price',
		'm.userId as _mar_userId',
		'm.priceType as _mar_priceType',
		'm.programElementName as _mar_programElementName',
		'm.peoplePased as _mar_peoplePased',
		'm.peopleCounter as _mar_peopleCounter',
		'm.launchedTimes as _mar_launchedTimes',
		'm.status as _mar_status',
		'm.startDate as _mar_startDate',
		'm.adminComment as _mar_adminComment',
		'm.createdAt as _mar_createdAt',
		'm.updatedAt as _mar_updatedAt',
		'm.deletedAt as _mar_deletedAt'
	])
	.from('users as u')
	.leftJoin('marathons as m', 'm.userId', 'u.id').where({id: id})
	
	console.log('QUERY', query)
	return await knexnest(query).then((data) => {
		return data
	})

I get this error:
column reference "id" is ambiguous
Is it issue for knexnest?

@shosanna
Copy link

Isn't the problem in the where clause, where you have {id: id} but you are not saying which id it is, from which table? I am not sure, I am a newbie trying to use this lib as well and I am having other problems myself :D

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