 |
|
 |
|
Next: are u like it
|
| Author |
Message |
External

Since: Jan 02, 2011 Posts: 3
|
(Msg. 1) Posted: Sun Jan 02, 2011 2:25 pm
Post subject: how to detect non-presence Archived from groups: alt>php>sql (more info?)
|
|
|
I'm building a website where I want to present information about some
items. Those items can for a longer or shorter time be present on
addresses that will be given is such is the case.
The relevant tables are of this type:
vartype, with the fields: ID(key), varnr, description
and
var, with the fields id(key), address, varnr.
Of course a join is to be made between the varnr-fileds.
The visitor can make a choice from a list generated by
$sql='SELECT DISTINCT varnr, description FROM vartype';
As the items to be presented come and go, sometimes in the list
generated are items that cannot be found in the var-table, when there
is no address to be given.
Now I wonder if there is a simple way to to present only those items
from the vartype-tabel that have a counterpart in the var-table?
I hope I made myself clear.
Any hint will be appreciated.
Susan >> Stay informed about: how to detect non-presence |
|
| Back to top |
|
 |  |
External

Since: Apr 23, 2007 Posts: 89
|
(Msg. 2) Posted: Sun Jan 02, 2011 2:25 pm
Post subject: Re: how to detect non-presence [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jan 2, 6:58 pm, Susan Boscha wrote:
> I'm building a website where I want to present information about some
> items. Those items can for a longer or shorter time be present on
> addresses that will be given is such is the case.
> The relevant tables are of this type:
> vartype, with the fields: ID(key), varnr, description
> and
> var, with the fields id(key), address, varnr.
> Of course a join is to be made between the varnr-fileds.
> The visitor can make a choice from a list generated by
> $sql='SELECT DISTINCT varnr, description FROM vartype';
> As the items to be presented come and go, sometimes in the list
> generated are items that cannot be found in the var-table, when there
> is no address to be given.
> Now I wonder if there is a simple way to to present only those items
> from the vartype-tabel that have a counterpart in the var-table?
>
> I hope I made myself clear.
> Any hint will be appreciated.
> Susan
That is what a JOIN does anyway! >> Stay informed about: how to detect non-presence |
|
| Back to top |
|
 |  |
External

Since: Jan 02, 2011 Posts: 3
|
(Msg. 3) Posted: Sun Jan 02, 2011 5:25 pm
Post subject: Re: how to detect non-presence [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Op Sun, 2 Jan 2011 11:54:45 -0800 (PST) schreef Captain Paralytic
:
>On Jan 2, 6:58 pm, Susan Boscha wrote:
>> I'm building a website where I want to present information about some
>> items. Those items can for a longer or shorter time be present on
>> addresses that will be given is such is the case.
>> The relevant tables are of this type:
>> vartype, with the fields: ID(key), varnr, description
>> and
>> var, with the fields id(key), address, varnr.
>> Of course a join is to be made between the varnr-fileds.
>> The visitor can make a choice from a list generated by
>> $sql='SELECT DISTINCT varnr, description FROM vartype';
>> As the items to be presented come and go, sometimes in the list
>> generated are items that cannot be found in the var-table, when there
>> is no address to be given.
>> Now I wonder if there is a simple way to to present only those items
>> from the vartype-tabel that have a counterpart in the var-table?
>>
>> I hope I made myself clear.
>> Any hint will be appreciated.
>> Susan
>
>That is what a JOIN does anyway!
Of course I make a join when I present the items that are there. But
how to eliminate items from the generated list where a join cannot be
made at that moment? >> Stay informed about: how to detect non-presence |
|
| Back to top |
|
 |  |
External

Since: Apr 23, 2007 Posts: 89
|
(Msg. 4) Posted: Mon Jan 03, 2011 4:34 am
Post subject: Re: how to detect non-presence [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Jan 2, 9:52 pm, Susan Boscha wrote:
> Op Sun, 2 Jan 2011 11:54:45 -0800 (PST) schreef Captain Paralytic
> :
>
>
>
>
>
> >On Jan 2, 6:58 pm, Susan Boscha wrote:
> >> I'm building a website where I want to present information about some
> >> items. Those items can for a longer or shorter time be present on
> >> addresses that will be given is such is the case.
> >> The relevant tables are of this type:
> >> vartype, with the fields: ID(key), varnr, description
> >> and
> >> var, with the fields id(key), address, varnr.
> >> Of course a join is to be made between the varnr-fileds.
> >> The visitor can make a choice from a list generated by
> >> $sql='SELECT DISTINCT varnr, description FROM vartype';
> >> As the items to be presented come and go, sometimes in the list
> >> generated are items that cannot be found in the var-table, when there
> >> is no address to be given.
> >> Now I wonder if there is a simple way to to present only those items
> >> from the vartype-tabel that have a counterpart in the var-table?
>
> >> I hope I made myself clear.
> >> Any hint will be appreciated.
> >> Susan
>
> >That is what a JOIN does anyway!
>
> Of course I make a join when I present the items that are there. But
> how to eliminate items from the generated list where a join cannot be
> made at that moment?
As I said, "That is what a JOIN does anyway!"
The result set of a JOIN (or more correctly an INNER JOIN) consists of
only those records where a successful match is made. >> Stay informed about: how to detect non-presence |
|
| Back to top |
|
 |  |
External

Since: Jan 02, 2011 Posts: 3
|
(Msg. 5) Posted: Mon Jan 03, 2011 5:25 pm
Post subject: Re: how to detect non-presence [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Op Mon, 3 Jan 2011 04:34:02 -0800 (PST) schreef Captain Paralytic
:
>On Jan 2, 9:52 pm, Susan Boscha wrote:
>> Op Sun, 2 Jan 2011 11:54:45 -0800 (PST) schreef Captain Paralytic
>> :
>>
>>
>>
>>
>>
>> >On Jan 2, 6:58 pm, Susan Boscha wrote:
>> >> I'm building a website where I want to present information about some
>> >> items. Those items can for a longer or shorter time be present on
>> >> addresses that will be given is such is the case.
>> >> The relevant tables are of this type:
>> >> vartype, with the fields: ID(key), varnr, description
>> >> and
>> >> var, with the fields id(key), address, varnr.
>> >> Of course a join is to be made between the varnr-fileds.
>> >> The visitor can make a choice from a list generated by
>> >> $sql='SELECT DISTINCT varnr, description FROM vartype';
>> >> As the items to be presented come and go, sometimes in the list
>> >> generated are items that cannot be found in the var-table, when there
>> >> is no address to be given.
>> >> Now I wonder if there is a simple way to to present only those items
>> >> from the vartype-tabel that have a counterpart in the var-table?
>>
>> >> I hope I made myself clear.
>> >> Any hint will be appreciated.
>> >> Susan
>>
>> >That is what a JOIN does anyway!
>>
>> Of course I make a join when I present the items that are there. But
>> how to eliminate items from the generated list where a join cannot be
>> made at that moment?
>
>As I said, "That is what a JOIN does anyway!"
>
>The result set of a JOIN (or more correctly an INNER JOIN) consists of
>only those records where a successful match is made.
Aha, I see, and now I'm feeling a bit stupid!
Thank you anyway. >> Stay informed about: how to detect non-presence |
|
| Back to top |
|
 |  |
| Related Topics: | multiple column sort MySQL - I am using $qryResult = mysql_query("ALTER TABLE MyTable ORDER BY County"); But I would like it sorted by multiple columns such as $qryResult = mysql_query("ALTER TABLE MyTable ORDER BY County"); $qryResult = mysql_query("ALT...
One query and problem LIMIT - Hi all, I have 2 tables: articles and categories articles table: ------------ articleid categoryid name categories table: --------------- categotyid name description I want to get the last entred 5 articles for each category with one quey: like..
multiple select but ......php/mysql/html - hello, Maybe someone can help me out with this one where i am stuck where i solve this in html or other code? html/php and mysql using in a html form: <tr> <td><?php echo"<font face=$b_fontface size=$b_fontsize&...
Create Tabel - Hi I am having some problems using MySQL. I am trying to create a table in a database using the query "CREATE TABLE enquiries (id int(6) NOT NULL auto_increment,name varchar(80) NOT NULL,email varchar(80) NOT NULL,company varchar(80) NOT NULL,tele...
Join same columns from two tables - Hi, I have two tabels. Table a and table b. Both tables habe a column named x. I need a sql statement, wich transfers the colum from a and b in the same colum in the resultset. Example: table a, column x cat dog duck human table b, column x cat duc... |
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
 |
|
|