SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2013
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What this SELECT do?

    Hi gurus,

    Okay I have this codes below,
    Code:
    $this->db->select('c.lessonid as clessonid, l.*, c.completionid');
    By the way the codes above is a SELECT command from CodeIgniter.
    But the SELECT() is a MySQL command.

    My question is what is this command below inside SELECT mean?,
    Code:
    l.*
    What does the asterisk and number one do/mean?
    Can someone please explain it in plain english.

    Thanks in advance.

  2. #2
    SitePoint Member
    Join Date
    Nov 2013
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The select is used to fetch the columns of a table. Here l indicates the alias of table or table name and the * means all columns from that table. Here is the complete syntaxt:

    Code:
    $this->db->select("columns")->from("tables")->where("conditions")->get();

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,274
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by super_noob View Post
    What does the asterisk and number one do/mean?
    it is the lower-case letter L followed by dot asterisk -- the asterisk means all columns, and the lower-case letter L is the table alias of one of the tables in the SELECT
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Mentor bronze trophy
    John_Betong's Avatar
    Join Date
    Aug 2005
    Location
    City of Angels
    Posts
    1,840
    Mentioned
    73 Post(s)
    Tagged
    6 Thread(s)
    After running the query try this:
    PHP Code:

    echo db_lastquery(); 
    // http://ellislab.com/codeigniter/user...e/helpers.html
    Learn how to be ready for The New Move to Discourse

    How to make Make Money Now with a *NEW* look

    Be sure to congratulate Patche on earning Member of the Month for July 2014


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
  •