---
title: "Column 'Site_name' - ambiguous problem"  
description: "Column 'Site_name' - ambiguous problem"  
author: "Anonymous User"  
published: 2014-09-30  
updated: 2014-09-30  
canonical: https://www.mindstick.com/forum/2288/column-site_name-ambiguous-problem  
category: "asp.net"  
tags: ["asp.net", "mssql server"]  
reading_time: 1 minute  

---

# Column 'Site_name' - ambiguous problem

I have [inner join](https://www.mindstick.com/forum/33572/sql-inner-join-keyword) [two tables](https://www.mindstick.com/forum/159646/how-to-join-two-tables-in-oracle-to-get-single-line-results) and display. I tried the given below code. But it generate on [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) "[Ambiguous Column](https://www.mindstick.com/forum/159609/explain-the-significance-of-an-ambiguous-column-reference-error) site_name' "

```
SELECT site_name, Mains_Run_Hrs, DG_Run_Auto_Mode, Battery_Run_Hrs,Solar_Run_hrs FROM tbl_runtime_report INNER JOIN tbl_site_details ON tbl_runtime_report.Site_ID=tbl_site_details.site_id WHEREsite_name=@site_name
```

## Replies

### Reply by Anonymous User

select top (1) Dg_energy_daily, Load_energy_daily, mains_energy_daily,solar_energy_daily

From tbl_energy_report

inner join tbl_site_details

ON tbl_energy_report.Site_ID=tbl_site_details.site_id

where tbl_site_details.site_name=@site_name order by sl_no desc

### Reply by Pravesh Singh

SELECT Report.ColumnName,Details.ColumnName

FROM tbl_runtime_report Report

INNER [JOIN](https://www.mindstick.com/articles/1487/join-sleep-and-interrupt-methods-in-c-sharp-threading) tbl_site_details Details ON Report.Site_ID=Details .site_id

WHERE [Report.site_name=@site_nam](mailto:Report.site_name=@site_nam)

### Reply by Anonymous User

Hi ankit, \
\

If site_name resides in both [tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development), you need to specify which version you are querying i.e.

WHERE tbl_runtime_report.site_name = @site_name

Alternatively, you could use an alias

SELECT rt.site_name, ...

FROM tbl_runtime_report rt ...

WHERE rt.site_name = @site_name

\


---

Original Source: https://www.mindstick.com/forum/2288/column-site_name-ambiguous-problem

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
