• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

The column prefix 'mir' does not match with a table name or alias name used in the query.

Here are my SP.

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO



ALTER    PROCEDURE nk_sp_menu_item_site_recipe_read  
      @menu_item_id int,
      @menu_site_id int
AS


Select mis.*,
msa.preset_total_reimbursable,
msa.preset_total_alacarte

from nk_menu_item_recipe mir,
nk_menu_site_assignment msa
left Join nk_menu_item_site mis on mis.menu_site_id = msa.menu_site_id
and mis.menu_item_recipe_id = mir.menu_item_recipe_id

Where msa.menu_site_id = @menu_site_id
and mir.menu_item_id = @menu_item_id
and msa.menu_letter_id = mir.menu_letter_id

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


THE ERROR IS

Server: Msg 107, Level 16, State 2, Procedure nk_sp_menu_item_site_recipe_read, Line 10
The column prefix 'mir' does not match with a table name or alias name used in the query.

I am scratching my head on this one. Whats wrong with the alias name mir?
0
lunchbyte
Asked:
lunchbyte
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
ALTER    PROCEDURE nk_sp_menu_item_site_recipe_read  
     @menu_item_id int,
     @menu_site_id int
AS
Select mis.*,
msa.preset_total_reimbursable,
msa.preset_total_alacarte
from nk_menu_item_recipe mir
join nk_menu_site_assignment msa
 on msa.menu_letter_id = mir.menu_letter_id
left Join nk_menu_item_site mis
 on mis.menu_site_id = msa.menu_site_id
and mis.menu_item_recipe_id = mir.menu_item_recipe_id
Where msa.menu_site_id = @menu_site_id
and mir.menu_item_id = @menu_item_id

0
 
Aneesh RetnakaranDatabase AdministratorCommented:
check whether the table nk_menu_item_recipe  contains the following fields
menu_letter_id
menu_item_recipe_id
menu_item_id
0
 
lunchbyteAuthor Commented:
I was missing one more table to get the correct menu letter id. Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now