Search Results

Search found 2 results on 1 pages for 'givenpie'.

Page 1/1 | 1 

  • How can I write query to output this format in SQLite?

    - by GivenPie
    I would like to output in this format: e.EE_id e.FNAME e.LNAME SUPer_id s.FNAME s.LNAME --- --------- -------------- --- ------------- ------------------- 1 Ziqiao Li 2 Charlie Li 1 Ziqiao Li 3 George Pee 2 Charlie Li 4 Jason Dee 2 Charlie Li 5 Petey Wee 2 Charlie Li From this table created : I need to display the Primary key and foreign key in the same results while displaying the foreign key name values for the primary key names. Create table Employees( ee_id integer, fname varchar(20), lname varchar(20), super_id integer, Constraint emp_Pk Primary Key (ee_id), Constraint emp_Fk Foreign Key (super_id) references employees (ee_id) ); INSERT INTO Employees VALUES(1,'Charlie','Li',null); INSERT INTO Employees VALUES(2,'Ziqiao','Lee',1); INSERT INTO Employees VALUES(3,'George','Pee',2); INSERT INTO Employees VALUES(4,'Jason','Dee',2); INSERT INTO Employees VALUES(5,'Petey','Wee',2); Select ee_id, fname, lname, super_id from employees; ee_id fname lname super_id ---------- ---------- ---------- ---------- 1 Charlie Li 2 Ziqiao Lee 1 3 George Pee 2 4 Jason Dee 2 5 Petey Wee 2 Do I need to create a view?

    Read the article

  • MySql Query to return number of photos in each album

    - by GivenPie
    MY table is set up like this, all I need to do is call a query to my Photos table. I have PhotoID as the primary key and GalleryID as the foreign key to Gallery. How can I could the number of unique PhotoID's for each multiple GalleryIDs. So to speak there are may duplicate GalleryIDs because there are many photos in a gallery. So I just need to could the number of unique PhotoIDs associated with that GalleryID. Can it be done in one query?

    Read the article

1