SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Passing parameters to a MySql Query


Passing parameters to a MySql Query

Author
Message
Reg_Mayfield
Reg_Mayfield
SSC-Enthusiastic
SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)SSC-Enthusiastic (175 reputation)

Group: General Forum Members
Points: 175 Visits: 337
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...



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search