SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql - is it possible a view with parameters

    Hi all,
    sorry to bother you but it's asked to me (my pm)
    to create a view from a select like this
    PHP Code:
    SELECT count(idFROM mytable where field1 IS NOT NULL AND field2 
    I put 1 but it can be any other number like 3 ... 1000
    All in all it worth create a view for a simple query ?
    Thanks in advance.
    weelly

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,273
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by weelly View Post
    All in all it worth create a view for a simple query ?
    in my opinion, no

    besides, a view cannot accept a runtime parameter (e.g. value for field2), so you'd have to write a stored procedure instead

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks it's also my opinion but .... ^^


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •