Skip to main content
edited tags
Link
Your Common Sense
  • 158.2k
  • 42
  • 226
  • 374
added 152 characters in body
Source Link
Vidarious
  • 836
  • 3
  • 13
  • 25

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_list with columns 'id', 'name', 'date' and event_default with one column 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

Success! Thank you. I ended up using:

$this->connection->query('SELECT * FROM event_list el JOIN event_default ef ON el.id = ef.default_id');

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_list with columns 'id', 'name', 'date' and event_default with one column 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_list with columns 'id', 'name', 'date' and event_default with one column 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

Success! Thank you. I ended up using:

$this->connection->query('SELECT * FROM event_list el JOIN event_default ef ON el.id = ef.default_id');
added 3 characters in body; edited tags
Source Link
Vidarious
  • 836
  • 3
  • 13
  • 25

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_listevent_list with coloumnscolumns 'id', 'name', 'date' and event_defaultevent_default with one coloumncolumn 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_list with coloumns 'id', 'name', 'date' and event_default with one coloumn 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

I'm having a hard time finding this answer so I'm hoping you guy can help me out.

I have two tables:

event_list with columns 'id', 'name', 'date' and event_default with one column 'default_id' which is a foreign key event_list('id')

The idea is that only one event can be default at a time, hence why event_default can only have one value (the id of the event in event_list).

I need a SELECT statement that obtains the event_list data of the event that is currently default. But I want to do this in one SELECT statement which I think I can do rather then two. I am using the PDO framework if that helps.

edited tags
Link
OMG Ponies
  • 333.9k
  • 85
  • 536
  • 508
Loading
added 3 characters in body; edited tags
Source Link
Vidarious
  • 836
  • 3
  • 13
  • 25
Loading
edited tags
Link
OMG Ponies
  • 333.9k
  • 85
  • 536
  • 508
Loading
Source Link
Vidarious
  • 836
  • 3
  • 13
  • 25
Loading