talk@lists.collectionspace.org

WE HAVE SUNSET THIS LISTSERV - Join us at collectionspace@lyrasislists.org

View all threads

Help with SQL query for Jasper reports

YN
Yousuf Nejati
Fri, Oct 13, 2017 2:47 PM

Hi all,

Thought I'd tap into those of you who have more experience writing complex
SQL queries (cough John Lowe and team).

I'm trying to get both the birth and death dates for person authorities via
structuredDateGroup.

Currently I'm receiving "org.postgresql.util.PSQLException::ERROR: column
reference "datedisplaydate" is ambiguous" and I don't quite understand how
to resolve this. In the past I resolved this by simply assigning an alias,
but as you can see in the script, this has already been applied.

Any ideas would be appreciated.

The script is attached.

Thank you,

Y

--
Yousuf Nejati
CollectionSpace Service Provider
www.yousufnejati.com/collectionspace
www.collectionspace.org/find-a-registered-service-provider/

Hi all, Thought I'd tap into those of you who have more experience writing complex SQL queries (*cough* John Lowe and team). I'm trying to get both the birth and death dates for person authorities via structuredDateGroup. Currently I'm receiving "org.postgresql.util.PSQLException::ERROR: column reference "datedisplaydate" is ambiguous" and I don't quite understand how to resolve this. In the past I resolved this by simply assigning an alias, but as you can see in the script, this has already been applied. Any ideas would be appreciated. The script is attached. Thank you, Y -- *Yousuf Nejati* CollectionSpace Service Provider www.yousufnejati.com/collectionspace www.collectionspace.org/find-a-registered-service-provider/
JM
Jesse Martinez
Fri, Oct 13, 2017 3:18 PM

Hi Yousuf,

Try this in the SELECT clause:

sdg.datedisplaydate datedisplaydate,

and add this to the GROUP BY clause:

GROUP BY ... , sdg.datedisplaydate, ...

Here's the version I used to test. I commented out the extended schema that
I don't have for conditionstatus.
https://gist.github.com/jessemartinez/0665f83cdca6db6e4ac15fa3b318e7c8

Jesse

On Fri, Oct 13, 2017 at 10:47 AM, Yousuf Nejati yousuf.cspace@gmail.com
wrote:

Hi all,

Thought I'd tap into those of you who have more experience writing complex
SQL queries (cough John Lowe and team).

I'm trying to get both the birth and death dates for person authorities
via structuredDateGroup.

Currently I'm receiving "org.postgresql.util.PSQLException::ERROR: column
reference "datedisplaydate" is ambiguous" and I don't quite understand how
to resolve this. In the past I resolved this by simply assigning an alias,
but as you can see in the script, this has already been applied.

Any ideas would be appreciated.

The script is attached.

Thank you,

Y

--
Yousuf Nejati
CollectionSpace Service Provider
www.yousufnejati.com/collectionspace
www.collectionspace.org/find-a-registered-service-provider/


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_
lists.collectionspace.org

Hi Yousuf, Try this in the SELECT clause: sdg.datedisplaydate datedisplaydate, and add this to the GROUP BY clause: GROUP BY ... , sdg.datedisplaydate, ... Here's the version I used to test. I commented out the extended schema that I don't have for conditionstatus. https://gist.github.com/jessemartinez/0665f83cdca6db6e4ac15fa3b318e7c8 Jesse On Fri, Oct 13, 2017 at 10:47 AM, Yousuf Nejati <yousuf.cspace@gmail.com> wrote: > Hi all, > > Thought I'd tap into those of you who have more experience writing complex > SQL queries (*cough* John Lowe and team). > > I'm trying to get both the birth and death dates for person authorities > via structuredDateGroup. > > Currently I'm receiving "org.postgresql.util.PSQLException::ERROR: column > reference "datedisplaydate" is ambiguous" and I don't quite understand how > to resolve this. In the past I resolved this by simply assigning an alias, > but as you can see in the script, this has already been applied. > > Any ideas would be appreciated. > > The script is attached. > > Thank you, > > Y > > -- > *Yousuf Nejati* > CollectionSpace Service Provider > www.yousufnejati.com/collectionspace > www.collectionspace.org/find-a-registered-service-provider/ > > _______________________________________________ > Talk mailing list > Talk@lists.collectionspace.org > http://lists.collectionspace.org/mailman/listinfo/talk_ > lists.collectionspace.org > >
YN
Yousuf Nejati
Fri, Oct 13, 2017 4:10 PM

Yes!! The GROUP BY clause totally worked.  Thank you, Jesse!

-Yousuf

On Fri, Oct 13, 2017 at 8:18 AM, Jesse Martinez mjesse@gmail.com wrote:

Hi Yousuf,

Try this in the SELECT clause:

sdg.datedisplaydate datedisplaydate,

and add this to the GROUP BY clause:

GROUP BY ... , sdg.datedisplaydate, ...

Here's the version I used to test. I commented out the extended schema
that I don't have for conditionstatus.
https://gist.github.com/jessemartinez/0665f83cdca6db6e4ac15fa3b318e7c8

Jesse

On Fri, Oct 13, 2017 at 10:47 AM, Yousuf Nejati yousuf.cspace@gmail.com
wrote:

Hi all,

Thought I'd tap into those of you who have more experience writing
complex SQL queries (cough John Lowe and team).

I'm trying to get both the birth and death dates for person authorities
via structuredDateGroup.

Currently I'm receiving "org.postgresql.util.PSQLException::ERROR:
column reference "datedisplaydate" is ambiguous" and I don't quite
understand how to resolve this. In the past I resolved this by simply
assigning an alias, but as you can see in the script, this has already been
applied.

Any ideas would be appreciated.

The script is attached.

Thank you,

Y

--
Yousuf Nejati
CollectionSpace Service Provider
www.yousufnejati.com/collectionspace
www.collectionspace.org/find-a-registered-service-provider/


Talk mailing list
Talk@lists.collectionspace.org
http://lists.collectionspace.org/mailman/listinfo/talk_lists
.collectionspace.org

Yes!! The GROUP BY clause totally worked. Thank you, Jesse! -Yousuf On Fri, Oct 13, 2017 at 8:18 AM, Jesse Martinez <mjesse@gmail.com> wrote: > Hi Yousuf, > > Try this in the SELECT clause: > > sdg.datedisplaydate datedisplaydate, > > and add this to the GROUP BY clause: > > GROUP BY ... , sdg.datedisplaydate, ... > > Here's the version I used to test. I commented out the extended schema > that I don't have for conditionstatus. > https://gist.github.com/jessemartinez/0665f83cdca6db6e4ac15fa3b318e7c8 > > > Jesse > > On Fri, Oct 13, 2017 at 10:47 AM, Yousuf Nejati <yousuf.cspace@gmail.com> > wrote: > >> Hi all, >> >> Thought I'd tap into those of you who have more experience writing >> complex SQL queries (*cough* John Lowe and team). >> >> I'm trying to get both the birth and death dates for person authorities >> via structuredDateGroup. >> >> Currently I'm receiving "org.postgresql.util.PSQLException::ERROR: >> column reference "datedisplaydate" is ambiguous" and I don't quite >> understand how to resolve this. In the past I resolved this by simply >> assigning an alias, but as you can see in the script, this has already been >> applied. >> >> Any ideas would be appreciated. >> >> The script is attached. >> >> Thank you, >> >> Y >> >> -- >> *Yousuf Nejati* >> CollectionSpace Service Provider >> www.yousufnejati.com/collectionspace >> www.collectionspace.org/find-a-registered-service-provider/ >> >> _______________________________________________ >> Talk mailing list >> Talk@lists.collectionspace.org >> http://lists.collectionspace.org/mailman/listinfo/talk_lists >> .collectionspace.org >> >> > -- *Yousuf Nejati* CollectionSpace Service Provider www.yousufnejati.com/collectionspace www.collectionspace.org/find-a-registered-service-provider/