I have alot of tables in database in one of this contains owner_id and another one have relation many to many with that,and that table have dissent_type how i can select dissent_type where owner_id = ""

Well, not sure whether you want to fetch all rows where owner_id contains empty string (where an instance physically exists in table) or where owner_id is NULL (that special value what indicates that instance does not physically exist in table) I state example for both, empty string and NULL value:

select dissent_type from thattable where owner_id = '' or owner_id IS NULL;

On the other hand, suffix _id of owner_id connotes someone that owner_id would be kind of primary key. If so, you should improve your table design for those rows you are looking for are orphans, in other words, referential integrity is destroyed.

Remark: "" (two double quotes) should not be used as string delimeters, use '' (two single quotation marks) instead. There are databases which report errors when mistaken these both different delimeters.

-- tesu

select dissent_type from thattable where owner_id = "....."
but that give me
The specified field 'owner_id' could refer to more than one table listed in the FROM clause of your SQL statement

... could refer to more than one table listed in the FROM clause ...

Aha, I see!

You might be more precise, state a practical example, post in the concrete, possibly wrong sql select statement you are talking about, or even post your create-table DDLs you would like to get some pieces of advice.

btw, if it refers to various tables, you may have to use table joins.

-- tesu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.