Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Passing parameters to a MySql Query Expand / Collapse
Author
Message
Posted Friday, July 23, 2010 11:06 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 6:14 AM
Points: 67, Visits: 284
I have a report that accesses a MySql (5.1) database and the query runs fine, but I want to be able to use a parameter in the query. I have tried using the @ sign like that used in Sql Server and also the "?" sign as per some of the articles I have seen for MySql but neither seem to work...Here is a part of the query that I am trying to change to use a parameter:

SELECT h.Host,
Date(from_unixtime(clock)) as TempDate,
Hour(from_unixtime(clock)) DIV 4 as IntervalY,
Min(Value) as MinTemp,
Max(Value) as MaxTemp
FROM `zabbix`.`history_uint` hu
join `zabbix`.`items` i on hu.itemid = i.itemid
join `zabbix`.`hosts` h on i.hostid = h.hostid
where hu.itemid = 100100000155581

I want to be able to pass in different Itemid ...

Thanks in advance for any help...



Post #958125
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse