|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Field names easy question
Hi,
If I have table A_______table_B field1A________field1B field2A________field2B Instead of the above, I just define them as: table A_______table_B field1________field1 field2________field2 Different tables, but each table has field names that are the same as the other table. Any problem? Thanks, John |
|
#2
|
|||
|
|||
|
John,
That's perfectly fine... Just be careful that when querying both tables in a JOIN you need to precede the field name with the table name: tableA.field1, tableB.field1, etc...
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
If you are doing a query involving both of these tables at once (join or union), you may then have to alias (using AS) one set of those variables so that they have a unique name in the scope of the query. Otherwise, no prob.
|
|
#4
|
|||
|
|||
|
For easier maintenance I would suggest that you use "unique table" fields..
What I always do is place an abbreviation in the field name, something like this table (customers) fields: cst_id cst_name cst_address etc. table (invoice) fields: inv_id inv_cst_id inv_date This makes it more clear for myself during programming. Later on you'll probably make the names more generic but why not name some things to the information they have. (I bet you can see that these tables have an inner join and that one customer can have multiple invoices. ![]() Cheers + hope this helps as well. Werner |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Field names easy question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|