MedicOneSystems / MedicOneSystems/livewire-datatables

Ambiguous column name in pagination

Open
#362 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1.2k
Forks
257
PR merge metrics
No merged PRs in 30d

Description

Hello,
I'm using datatables with province, region and nation. In province table, it don't work because of same coloumn name in the tables.

How I could solve?

SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Ambiguous column name 'nome'. (SQL: select * from (select [provincia].[id] as [id], [nazione].[nome] as [nazione.nome], [regione].[nome] as [regione.nome], [provincia].[nome] as [nome], [provincia].[attiva] as [attiva], CONCAT_WS('|**lwdt**|' ,COALESCE(provincia.id, ''), COALESCE(provincia.nome, ''), COALESCE(provincia.sigla, '')) AS 'callback_1172756607', row_number() over (order by "nome" asc) as row_num from [provincia] left join [regione] on [regione].[id] = [provincia].[id_regione] left join [nazione] on [nazione].[id] = [provincia].[id_nazione]) as temp_table where row_num between 26 and 50 order by row_num) (View: C:\Program Files (x86)\EasyPHP-Devserver-17\eds-www\sweet0\resources\views\livewire\datatables\datatable.blade.php)

Thank You so much

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the province, region and nation pagination query on SQL Server, then inspect the generated SQL and the referenced resources/views/livewire/datatables/datatable.blade.php. Done means ordering by the province name no longer produces an ambiguous-column error and pagination returns the expected rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php, sql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.