logo
down
shadow

php/mysql. selecting 2 common fields in 2 tables


php/mysql. selecting 2 common fields in 2 tables

By : user45944
Date : January 12 2021, 08:33 AM
should help you out You need to add the join condition properly, so if you have a primary key Id in the students table and another foreign key studentid in the attendance table use it. And use ANSI join syntax like this:
code :
SELECT 
  s.name as StudentName, 
  a.timelogin as TimeLogin, 
  a.datelogin as DateLogin 
  UPPER(LEFT(status, 1)) AS Status
FROM students AS s 
INNER JOIN attendance AS a ON s.Id = a.StudentId
WHERE s.strand LIKE '%TVL%' 
  AND s.gender ='Male' 
  AND a.datelogin LIKE '%{$month}%' 
  AND a.timelogin >= '12' 
ORDER BY s.name ASC;


Share : facebook icon twitter icon
Selecting two Fields from two different tables as one (using Join) (MYSQL)

Selecting two Fields from two different tables as one (using Join) (MYSQL)


By : Joey-Magani
Date : March 29 2020, 07:55 AM
wish help you to fix your issue Are you saying you want Articles_Fitness.StartDate if present, otherwise Articles.PublicationDate? You can return that in one column:
code :
...
DATE_FORMAT(COALESCE(Articles_Fitness.StartDate, Articles.PublicationDate),
            '%M %d, %Y') AS Formatted_Date
...
selecting fields from multiple MySQL tables and what does (1=2) mean?

selecting fields from multiple MySQL tables and what does (1=2) mean?


By : Kevin Leutzinger
Date : March 29 2020, 07:55 AM
seems to work fine
there is no need to cfparam query fields such as qp.seller, or is there?
MYSQL Selecting data from two different tables and no common variable name

MYSQL Selecting data from two different tables and no common variable name


By : REPLIKANT
Date : March 29 2020, 07:55 AM
I wish this help you What's happening is that your inner query returns multiple rows, so change it to where EMP_NBR in to retrieve all matches.
The problem your query has is that it doesn't make sense to say = (a set which returns multiple rows), since it's unclear what exactly should be matched.
mysql: join two tables with two fields in common to get a third table

mysql: join two tables with two fields in common to get a third table


By : Daryl Bagley
Date : March 29 2020, 07:55 AM
around this issue I suggest you may want to read some info about SQL JOIN. Here are some great examples.
This is the format you are probably looking for:
code :
SELECT TableA.*, TableB.*, TableC.*, TableD.*
FROM TableA
    JOIN TableB
        ON TableB.aID = TableA.aID
    JOIN TableC
        ON TableC.cID = TableB.cID
    JOIN TableD
        ON TableD.dID = TableA.dID
INSERT INTO Customers (CustomerName, Country)
SELECT SupplierName, Country FROM Suppliers
WHERE Country='Germany';
how to join two different tables in mysql,with no fields common?

how to join two different tables in mysql,with no fields common?


By : user3514584
Date : March 29 2020, 07:55 AM
around this issue If you really want to do this, you need to invent some sort of joining column. Variables can be used for that:
code :
select q1.name as car, q2.name as colour 
from
  (select @row := @row + 1 as r, name from car, (select @row := 0) q) q1
inner join
  (select @row2 := @row2 + 1 as r, name from colour, (select @row2 := 0) q) q2
on q1.r = q2.r;
shadow
Privacy Policy - Terms - Contact Us © voile276.org